{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import pandas as pd\n",
    "from pyreadstat import pyreadstat\n",
    "from pandas.api.types import CategoricalDtype\n",
    "import scipy.stats as stats\n",
    "import statsmodels.api as sm\n",
    "import plotly.express as px\n",
    "import mytools\n",
    "import nbformat\n",
    "import datetime\n",
    "import kaleido"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "df1=pd.read_excel(r\"茅台冰激凌问卷调查.xlsx\")"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 明确数据分析目标\n",
    "\n",
    "该研究的目的详细描述大学生群体对手机APP开屏广告的态度。属于描述性研究。\n",
    "\n",
    "描述性研究对社会现象的状况、过程和特征进行客观准确的描述。进而揭示某种现象是什么，是如何发展的，特点和性质是什么。描述性研究的基本要求是对社会现象的描述应当达到描述的准确性和概括性的要求。描述性研究的描述的是某个情境、社会环境或事物关系的特定细节。\n",
    "\n",
    "描述性研究很重要，在没有很强的假定的条件下，能做的只能是描述性研究。\n",
    "\n",
    "该问卷属于非量表类问卷，并没有相关学术理论依据作为参考。\n",
    "\n",
    "非量表性问卷的设计，通常包括：\n",
    "\n",
    "筛选题目。如您是否为大学生等等\n",
    "样本背景信息题目。如性别、年龄、学历、专业等等\n",
    "样本特征信息题目。如购买季节等等。\n",
    "样本基本现状题目。如遇到品牌联盟出新产品的行为、是否购买过此产品。\n",
    "样本基本态度题目。如购买的因素等等。\n",
    "其他题目\n",
    "\n",
    "非量表性问卷的分析思路是先对样本背景信息进行统计，然后描述样本基本情况和基本态度，还可以作一些差异性分析。\n",
    "\n",
    "## 数据获取\n",
    "\n",
    "本研究采用问卷调查法，采用方便抽样方法，通过问卷星网站发放问卷，共获得有效样本155个。\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>提交时间</th>\n",
       "      <th>1.性别</th>\n",
       "      <th>2.是否为大学生？</th>\n",
       "      <th>3.年级</th>\n",
       "      <th>4.年龄</th>\n",
       "      <th>5.您是否购买过该产品？</th>\n",
       "      <th>6.您不购买的理由是？</th>\n",
       "      <th>7.您是否会选择再次购买？</th>\n",
       "      <th>8.您不会再次购买的理由是？</th>\n",
       "      <th>9.您选择再次购买的理由是？</th>\n",
       "      <th>...</th>\n",
       "      <th>11.遇到品牌联名出新产品（如“茅台冰淇淋”），您会</th>\n",
       "      <th>12.您一般会购买茅台冰淇淋的原因</th>\n",
       "      <th>13.茅台冰淇淋的网络热搜会增加你的购买欲望吗？</th>\n",
       "      <th>14.在购买时您主要考虑的因素是什么</th>\n",
       "      <th>15.你对品牌联名推出的产品接受程度?</th>\n",
       "      <th>16.您觉得茅台冰淇淋哪种促销方式最吸引您</th>\n",
       "      <th>17.你认为茅台与蒙牛联名的冰淇淋火热的原因?</th>\n",
       "      <th>18.您更倾向哪种购物体验</th>\n",
       "      <th>19.你认为茅台和蒙牛此次的联名会产生怎样的营销效果?</th>\n",
       "      <th>20.您希望在可以在哪些方面做出改进</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>0 rows × 21 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "Empty DataFrame\n",
       "Columns: [提交时间, 1.性别, 2.是否为大学生？, 3.年级, 4.年龄, 5.您是否购买过该产品？, 6.您不购买的理由是？, 7.您是否会选择再次购买？, 8.您不会再次购买的理由是？, 9.您选择再次购买的理由是？, 10.您会在什么季节购买茅台冰淇淋, 11.遇到品牌联名出新产品（如“茅台冰淇淋”），您会, 12.您一般会购买茅台冰淇淋的原因, 13.茅台冰淇淋的网络热搜会增加你的购买欲望吗？, 14.在购买时您主要考虑的因素是什么, 15.你对品牌联名推出的产品接受程度?, 16.您觉得茅台冰淇淋哪种促销方式最吸引您, 17.你认为茅台与蒙牛联名的冰淇淋火热的原因?, 18.您更倾向哪种购物体验, 19.你认为茅台和蒙牛此次的联名会产生怎样的营销效果?, 20.您希望在可以在哪些方面做出改进]\n",
       "Index: []\n",
       "\n",
       "[0 rows x 21 columns]"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "## 数据清理\n",
    "### 查看所有空白值\n",
    "temp = df1[df1.isnull().T.any()]\n",
    "temp"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "#### 删除空值\n",
    "df2 = df1.dropna()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>提交时间</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>51</th>\n",
       "      <td>2022/12/08 18:53:20</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>143</th>\n",
       "      <td>2022/12/02 14:45:32</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                    提交时间\n",
       "51   2022/12/08 18:53:20\n",
       "143  2022/12/02 14:45:32"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "## 查看重复值\n",
    "df2[df2.duplicated(subset=['提交时间'],keep='first')][['提交时间']]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>提交时间</th>\n",
       "      <th>1.性别</th>\n",
       "      <th>2.是否为大学生？</th>\n",
       "      <th>3.年级</th>\n",
       "      <th>4.年龄</th>\n",
       "      <th>5.您是否购买过该产品？</th>\n",
       "      <th>6.您不购买的理由是？</th>\n",
       "      <th>7.您是否会选择再次购买？</th>\n",
       "      <th>8.您不会再次购买的理由是？</th>\n",
       "      <th>9.您选择再次购买的理由是？</th>\n",
       "      <th>...</th>\n",
       "      <th>11.遇到品牌联名出新产品（如“茅台冰淇淋”），您会</th>\n",
       "      <th>12.您一般会购买茅台冰淇淋的原因</th>\n",
       "      <th>13.茅台冰淇淋的网络热搜会增加你的购买欲望吗？</th>\n",
       "      <th>14.在购买时您主要考虑的因素是什么</th>\n",
       "      <th>15.你对品牌联名推出的产品接受程度?</th>\n",
       "      <th>16.您觉得茅台冰淇淋哪种促销方式最吸引您</th>\n",
       "      <th>17.你认为茅台与蒙牛联名的冰淇淋火热的原因?</th>\n",
       "      <th>18.您更倾向哪种购物体验</th>\n",
       "      <th>19.你认为茅台和蒙牛此次的联名会产生怎样的营销效果?</th>\n",
       "      <th>20.您希望在可以在哪些方面做出改进</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2022/12/10 13:24:50</td>\n",
       "      <td>【B.女】</td>\n",
       "      <td>【B.否】</td>\n",
       "      <td>-</td>\n",
       "      <td>【A.18岁以下】</td>\n",
       "      <td>【A.没有】</td>\n",
       "      <td>【A.没听说过】</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>...</td>\n",
       "      <td>【A.好奇新意想购买尝一尝】</td>\n",
       "      <td>【B.新品活动、对新鲜口感好奇】</td>\n",
       "      <td>【A.会增加】</td>\n",
       "      <td>【A.对品牌/设计师的喜爱】</td>\n",
       "      <td>【A.很满意，是强强联合的优秀成果】</td>\n",
       "      <td>【B.买赠（如买一送一）】</td>\n",
       "      <td>【A.品牌产品之间跨度大，比较新奇】</td>\n",
       "      <td>【C.两者都用】</td>\n",
       "      <td>【A.明显提高茅台与蒙牛的知名度】,【B.拓展品牌的消费群体】,【C.增加产品的多样性】,【...</td>\n",
       "      <td>【A.降低价格】,【B.丰富口味】,【C.扩大产品知名度】,【D.创新雪糕形状】,【E.增加...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2022/12/10 08:41:54</td>\n",
       "      <td>【B.女】</td>\n",
       "      <td>【A.是】</td>\n",
       "      <td>【A.大一】</td>\n",
       "      <td>【B.18-24岁】</td>\n",
       "      <td>【A.没有】</td>\n",
       "      <td>【B.不感兴趣】,【C.价格超出预期】</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>...</td>\n",
       "      <td>【B.了解一下但不购买】</td>\n",
       "      <td>【B.新品活动、对新鲜口感好奇】,【C.促销活动、价格划算】,【D.网络博主或朋友推荐】</td>\n",
       "      <td>【B.不会增加】</td>\n",
       "      <td>【B.包装】,【D.价格】</td>\n",
       "      <td>【C.一般，消费不关心品牌】</td>\n",
       "      <td>【B.买赠（如买一送一）】,【D.赠送限定特制小礼】</td>\n",
       "      <td>【A.品牌产品之间跨度大，比较新奇】,【B.人们想体验酒味冰淇淋是否会醉酒】,【C.对酒中奢...</td>\n",
       "      <td>【A.线下购买】</td>\n",
       "      <td>【A.明显提高茅台与蒙牛的知名度】,【C.增加产品的多样性】,【D.带给品牌更多的话题和关注...</td>\n",
       "      <td>【A.降低价格】,【E.增加线下专柜】</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2022/12/09 23:17:16</td>\n",
       "      <td>【A.男】</td>\n",
       "      <td>【A.是】</td>\n",
       "      <td>【A.大一】</td>\n",
       "      <td>【A.18岁以下】</td>\n",
       "      <td>【A.没有】</td>\n",
       "      <td>【A.没听说过】,【B.不感兴趣】,【C.价格超出预期】</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>...</td>\n",
       "      <td>【A.好奇新意想购买尝一尝】</td>\n",
       "      <td>【A.天热口喝、刚需购买】,【B.新品活动、对新鲜口感好奇】,【C.促销活动、价格划算】,【...</td>\n",
       "      <td>【A.会增加】</td>\n",
       "      <td>【A.对品牌/设计师的喜爱】,【B.包装】,【C.成分】,【D.价格】</td>\n",
       "      <td>【C.一般，消费不关心品牌】</td>\n",
       "      <td>【C.积分有礼】,【D.赠送限定特制小礼】</td>\n",
       "      <td>【A.品牌产品之间跨度大，比较新奇】,【C.对酒中奢侈品的追求欲望】</td>\n",
       "      <td>【C.两者都用】</td>\n",
       "      <td>【C.增加产品的多样性】,【E.风险大，冰淇淋的接受直接影响了品牌口碑容易流失原本客户】</td>\n",
       "      <td>【C.扩大产品知名度】</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>2022/12/09 21:56:07</td>\n",
       "      <td>【B.女】</td>\n",
       "      <td>【A.是】</td>\n",
       "      <td>【D.大四】</td>\n",
       "      <td>【C.25-35岁】</td>\n",
       "      <td>【A.没有】</td>\n",
       "      <td>【B.不感兴趣】</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>...</td>\n",
       "      <td>【A.好奇新意想购买尝一尝】</td>\n",
       "      <td>【B.新品活动、对新鲜口感好奇】,【D.网络博主或朋友推荐】</td>\n",
       "      <td>【C.不一定】</td>\n",
       "      <td>【A.对品牌/设计师的喜爱】,【B.包装】,【D.价格】</td>\n",
       "      <td>【C.一般，消费不关心品牌】</td>\n",
       "      <td>【A.抽奖】,【D.赠送限定特制小礼】</td>\n",
       "      <td>【A.品牌产品之间跨度大，比较新奇】,【C.对酒中奢侈品的追求欲望】,【E.盲目跟风的人较多...</td>\n",
       "      <td>【C.两者都用】</td>\n",
       "      <td>【B.拓展品牌的消费群体】,【C.增加产品的多样性】,【D.带给品牌更多的话题和关注度】</td>\n",
       "      <td>【A.降低价格】,【E.增加线下专柜】</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>2022/12/09 17:13:58</td>\n",
       "      <td>【B.女】</td>\n",
       "      <td>【A.是】</td>\n",
       "      <td>【B.大二】</td>\n",
       "      <td>【B.18-24岁】</td>\n",
       "      <td>【A.没有】</td>\n",
       "      <td>【C.价格超出预期】</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>...</td>\n",
       "      <td>【A.好奇新意想购买尝一尝】</td>\n",
       "      <td>【A.天热口喝、刚需购买】,【B.新品活动、对新鲜口感好奇】,【D.网络博主或朋友推荐】</td>\n",
       "      <td>【B.不会增加】</td>\n",
       "      <td>【B.包装】,【C.成分】,【D.价格】</td>\n",
       "      <td>【C.一般，消费不关心品牌】</td>\n",
       "      <td>【B.买赠（如买一送一）】,【D.赠送限定特制小礼】</td>\n",
       "      <td>【A.品牌产品之间跨度大，比较新奇】,【B.人们想体验酒味冰淇淋是否会醉酒】,【C.对酒中奢...</td>\n",
       "      <td>【C.两者都用】</td>\n",
       "      <td>【A.明显提高茅台与蒙牛的知名度】,【B.拓展品牌的消费群体】,【C.增加产品的多样性】,【...</td>\n",
       "      <td>【A.降低价格】,【B.丰富口味】,【C.扩大产品知名度】,【D.创新雪糕形状】,【E.增加...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>150</th>\n",
       "      <td>2022/12/02 14:39:56</td>\n",
       "      <td>【B.女】</td>\n",
       "      <td>【A.是】</td>\n",
       "      <td>【B.大二】</td>\n",
       "      <td>【B.18-24岁】</td>\n",
       "      <td>【A.没有】</td>\n",
       "      <td>【C.价格超出预期】</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>...</td>\n",
       "      <td>【B.了解一下但不购买】</td>\n",
       "      <td>【C.促销活动、价格划算】</td>\n",
       "      <td>【C.不一定】</td>\n",
       "      <td>【C.成分】,【D.价格】</td>\n",
       "      <td>【B.满意，主要看有没有自己喜欢的品牌】</td>\n",
       "      <td>【B.买赠（如买一送一）】</td>\n",
       "      <td>【A.品牌产品之间跨度大，比较新奇】,【B.人们想体验酒味冰淇淋是否会醉酒】,【C.对酒中奢...</td>\n",
       "      <td>【C.两者都用】</td>\n",
       "      <td>【A.明显提高茅台与蒙牛的知名度】,【D.带给品牌更多的话题和关注度】</td>\n",
       "      <td>【A.降低价格】,【B.丰富口味】</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>151</th>\n",
       "      <td>2022/12/02 14:39:51</td>\n",
       "      <td>【B.女】</td>\n",
       "      <td>【A.是】</td>\n",
       "      <td>【C.大三】</td>\n",
       "      <td>【B.18-24岁】</td>\n",
       "      <td>【A.没有】</td>\n",
       "      <td>【B.不感兴趣】,【C.价格超出预期】</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>...</td>\n",
       "      <td>【B.了解一下但不购买】</td>\n",
       "      <td>【B.新品活动、对新鲜口感好奇】,【D.网络博主或朋友推荐】</td>\n",
       "      <td>【A.会增加】</td>\n",
       "      <td>【B.包装】,【D.价格】</td>\n",
       "      <td>【D.不满意，是一种讨厌的营销手段】</td>\n",
       "      <td>【B.买赠（如买一送一）】</td>\n",
       "      <td>【A.品牌产品之间跨度大，比较新奇】,【B.人们想体验酒味冰淇淋是否会醉酒】,【E.盲目跟风...</td>\n",
       "      <td>【A.线下购买】</td>\n",
       "      <td>【A.明显提高茅台与蒙牛的知名度】,【E.风险大，冰淇淋的接受直接影响了品牌口碑容易流失原本客户】</td>\n",
       "      <td>【A.降低价格】,【E.增加线下专柜】</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>152</th>\n",
       "      <td>2022/12/02 14:39:02</td>\n",
       "      <td>【B.女】</td>\n",
       "      <td>【A.是】</td>\n",
       "      <td>【C.大三】</td>\n",
       "      <td>【B.18-24岁】</td>\n",
       "      <td>【A.没有】</td>\n",
       "      <td>【C.价格超出预期】</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>...</td>\n",
       "      <td>【A.好奇新意想购买尝一尝】</td>\n",
       "      <td>【B.新品活动、对新鲜口感好奇】</td>\n",
       "      <td>【C.不一定】</td>\n",
       "      <td>【A.对品牌/设计师的喜爱】</td>\n",
       "      <td>【C.一般，消费不关心品牌】</td>\n",
       "      <td>【B.买赠（如买一送一）】</td>\n",
       "      <td>【A.品牌产品之间跨度大，比较新奇】</td>\n",
       "      <td>【C.两者都用】</td>\n",
       "      <td>【E.风险大，冰淇淋的接受直接影响了品牌口碑容易流失原本客户】</td>\n",
       "      <td>【D.创新雪糕形状】,【E.增加线下专柜】</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>153</th>\n",
       "      <td>2022/12/02 14:34:47</td>\n",
       "      <td>【B.女】</td>\n",
       "      <td>【A.是】</td>\n",
       "      <td>【B.大二】</td>\n",
       "      <td>【B.18-24岁】</td>\n",
       "      <td>【A.没有】</td>\n",
       "      <td>【A.没听说过】</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>...</td>\n",
       "      <td>【A.好奇新意想购买尝一尝】</td>\n",
       "      <td>【B.新品活动、对新鲜口感好奇】,【D.网络博主或朋友推荐】</td>\n",
       "      <td>【A.会增加】</td>\n",
       "      <td>【A.对品牌/设计师的喜爱】,【B.包装】,【D.价格】</td>\n",
       "      <td>【B.满意，主要看有没有自己喜欢的品牌】</td>\n",
       "      <td>【A.抽奖】,【B.买赠（如买一送一）】,【D.赠送限定特制小礼】</td>\n",
       "      <td>【A.品牌产品之间跨度大，比较新奇】,【B.人们想体验酒味冰淇淋是否会醉酒】,【D.两个品牌...</td>\n",
       "      <td>【A.线下购买】</td>\n",
       "      <td>【A.明显提高茅台与蒙牛的知名度】,【B.拓展品牌的消费群体】,【C.增加产品的多样性】,【...</td>\n",
       "      <td>【A.降低价格】,【D.创新雪糕形状】,【E.增加线下专柜】</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>154</th>\n",
       "      <td>2022/12/02 14:32:09</td>\n",
       "      <td>【B.女】</td>\n",
       "      <td>【A.是】</td>\n",
       "      <td>【B.大二】</td>\n",
       "      <td>【B.18-24岁】</td>\n",
       "      <td>【A.没有】</td>\n",
       "      <td>【C.价格超出预期】</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>-</td>\n",
       "      <td>...</td>\n",
       "      <td>【A.好奇新意想购买尝一尝】</td>\n",
       "      <td>【B.新品活动、对新鲜口感好奇】,【C.促销活动、价格划算】</td>\n",
       "      <td>【C.不一定】</td>\n",
       "      <td>【A.对品牌/设计师的喜爱】,【C.成分】,【D.价格】</td>\n",
       "      <td>【A.很满意，是强强联合的优秀成果】</td>\n",
       "      <td>【B.买赠（如买一送一）】,【D.赠送限定特制小礼】</td>\n",
       "      <td>【A.品牌产品之间跨度大，比较新奇】,【B.人们想体验酒味冰淇淋是否会醉酒】,【C.对酒中奢...</td>\n",
       "      <td>【A.线下购买】</td>\n",
       "      <td>【A.明显提高茅台与蒙牛的知名度】,【B.拓展品牌的消费群体】,【C.增加产品的多样性】,【...</td>\n",
       "      <td>【A.降低价格】,【C.扩大产品知名度】,【E.增加线下专柜】</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>153 rows × 21 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                    提交时间   1.性别 2.是否为大学生？    3.年级        4.年龄 5.您是否购买过该产品？  \\\n",
       "0    2022/12/10 13:24:50  【B.女】     【B.否】       -   【A.18岁以下】       【A.没有】   \n",
       "1    2022/12/10 08:41:54  【B.女】     【A.是】  【A.大一】  【B.18-24岁】       【A.没有】   \n",
       "2    2022/12/09 23:17:16  【A.男】     【A.是】  【A.大一】   【A.18岁以下】       【A.没有】   \n",
       "3    2022/12/09 21:56:07  【B.女】     【A.是】  【D.大四】  【C.25-35岁】       【A.没有】   \n",
       "4    2022/12/09 17:13:58  【B.女】     【A.是】  【B.大二】  【B.18-24岁】       【A.没有】   \n",
       "..                   ...    ...       ...     ...         ...          ...   \n",
       "150  2022/12/02 14:39:56  【B.女】     【A.是】  【B.大二】  【B.18-24岁】       【A.没有】   \n",
       "151  2022/12/02 14:39:51  【B.女】     【A.是】  【C.大三】  【B.18-24岁】       【A.没有】   \n",
       "152  2022/12/02 14:39:02  【B.女】     【A.是】  【C.大三】  【B.18-24岁】       【A.没有】   \n",
       "153  2022/12/02 14:34:47  【B.女】     【A.是】  【B.大二】  【B.18-24岁】       【A.没有】   \n",
       "154  2022/12/02 14:32:09  【B.女】     【A.是】  【B.大二】  【B.18-24岁】       【A.没有】   \n",
       "\n",
       "                      6.您不购买的理由是？ 7.您是否会选择再次购买？ 8.您不会再次购买的理由是？ 9.您选择再次购买的理由是？  \\\n",
       "0                        【A.没听说过】             -              -              -   \n",
       "1             【B.不感兴趣】,【C.价格超出预期】             -              -              -   \n",
       "2    【A.没听说过】,【B.不感兴趣】,【C.价格超出预期】             -              -              -   \n",
       "3                        【B.不感兴趣】             -              -              -   \n",
       "4                      【C.价格超出预期】             -              -              -   \n",
       "..                            ...           ...            ...            ...   \n",
       "150                    【C.价格超出预期】             -              -              -   \n",
       "151           【B.不感兴趣】,【C.价格超出预期】             -              -              -   \n",
       "152                    【C.价格超出预期】             -              -              -   \n",
       "153                      【A.没听说过】             -              -              -   \n",
       "154                    【C.价格超出预期】             -              -              -   \n",
       "\n",
       "     ... 11.遇到品牌联名出新产品（如“茅台冰淇淋”），您会  \\\n",
       "0    ...             【A.好奇新意想购买尝一尝】   \n",
       "1    ...               【B.了解一下但不购买】   \n",
       "2    ...             【A.好奇新意想购买尝一尝】   \n",
       "3    ...             【A.好奇新意想购买尝一尝】   \n",
       "4    ...             【A.好奇新意想购买尝一尝】   \n",
       "..   ...                        ...   \n",
       "150  ...               【B.了解一下但不购买】   \n",
       "151  ...               【B.了解一下但不购买】   \n",
       "152  ...             【A.好奇新意想购买尝一尝】   \n",
       "153  ...             【A.好奇新意想购买尝一尝】   \n",
       "154  ...             【A.好奇新意想购买尝一尝】   \n",
       "\n",
       "                                     12.您一般会购买茅台冰淇淋的原因  \\\n",
       "0                                     【B.新品活动、对新鲜口感好奇】   \n",
       "1         【B.新品活动、对新鲜口感好奇】,【C.促销活动、价格划算】,【D.网络博主或朋友推荐】   \n",
       "2    【A.天热口喝、刚需购买】,【B.新品活动、对新鲜口感好奇】,【C.促销活动、价格划算】,【...   \n",
       "3                       【B.新品活动、对新鲜口感好奇】,【D.网络博主或朋友推荐】   \n",
       "4         【A.天热口喝、刚需购买】,【B.新品活动、对新鲜口感好奇】,【D.网络博主或朋友推荐】   \n",
       "..                                                 ...   \n",
       "150                                      【C.促销活动、价格划算】   \n",
       "151                     【B.新品活动、对新鲜口感好奇】,【D.网络博主或朋友推荐】   \n",
       "152                                   【B.新品活动、对新鲜口感好奇】   \n",
       "153                     【B.新品活动、对新鲜口感好奇】,【D.网络博主或朋友推荐】   \n",
       "154                     【B.新品活动、对新鲜口感好奇】,【C.促销活动、价格划算】   \n",
       "\n",
       "    13.茅台冰淇淋的网络热搜会增加你的购买欲望吗？                   14.在购买时您主要考虑的因素是什么  \\\n",
       "0                    【A.会增加】                       【A.对品牌/设计师的喜爱】   \n",
       "1                   【B.不会增加】                        【B.包装】,【D.价格】   \n",
       "2                    【A.会增加】  【A.对品牌/设计师的喜爱】,【B.包装】,【C.成分】,【D.价格】   \n",
       "3                    【C.不一定】         【A.对品牌/设计师的喜爱】,【B.包装】,【D.价格】   \n",
       "4                   【B.不会增加】                 【B.包装】,【C.成分】,【D.价格】   \n",
       "..                       ...                                  ...   \n",
       "150                  【C.不一定】                        【C.成分】,【D.价格】   \n",
       "151                  【A.会增加】                        【B.包装】,【D.价格】   \n",
       "152                  【C.不一定】                       【A.对品牌/设计师的喜爱】   \n",
       "153                  【A.会增加】         【A.对品牌/设计师的喜爱】,【B.包装】,【D.价格】   \n",
       "154                  【C.不一定】         【A.对品牌/设计师的喜爱】,【C.成分】,【D.价格】   \n",
       "\n",
       "      15.你对品牌联名推出的产品接受程度?              16.您觉得茅台冰淇淋哪种促销方式最吸引您  \\\n",
       "0      【A.很满意，是强强联合的优秀成果】                      【B.买赠（如买一送一）】   \n",
       "1          【C.一般，消费不关心品牌】         【B.买赠（如买一送一）】,【D.赠送限定特制小礼】   \n",
       "2          【C.一般，消费不关心品牌】              【C.积分有礼】,【D.赠送限定特制小礼】   \n",
       "3          【C.一般，消费不关心品牌】                【A.抽奖】,【D.赠送限定特制小礼】   \n",
       "4          【C.一般，消费不关心品牌】         【B.买赠（如买一送一）】,【D.赠送限定特制小礼】   \n",
       "..                    ...                                ...   \n",
       "150  【B.满意，主要看有没有自己喜欢的品牌】                      【B.买赠（如买一送一）】   \n",
       "151    【D.不满意，是一种讨厌的营销手段】                      【B.买赠（如买一送一）】   \n",
       "152        【C.一般，消费不关心品牌】                      【B.买赠（如买一送一）】   \n",
       "153  【B.满意，主要看有没有自己喜欢的品牌】  【A.抽奖】,【B.买赠（如买一送一）】,【D.赠送限定特制小礼】   \n",
       "154    【A.很满意，是强强联合的优秀成果】         【B.买赠（如买一送一）】,【D.赠送限定特制小礼】   \n",
       "\n",
       "                               17.你认为茅台与蒙牛联名的冰淇淋火热的原因? 18.您更倾向哪种购物体验  \\\n",
       "0                                   【A.品牌产品之间跨度大，比较新奇】      【C.两者都用】   \n",
       "1    【A.品牌产品之间跨度大，比较新奇】,【B.人们想体验酒味冰淇淋是否会醉酒】,【C.对酒中奢...      【A.线下购买】   \n",
       "2                   【A.品牌产品之间跨度大，比较新奇】,【C.对酒中奢侈品的追求欲望】      【C.两者都用】   \n",
       "3    【A.品牌产品之间跨度大，比较新奇】,【C.对酒中奢侈品的追求欲望】,【E.盲目跟风的人较多...      【C.两者都用】   \n",
       "4    【A.品牌产品之间跨度大，比较新奇】,【B.人们想体验酒味冰淇淋是否会醉酒】,【C.对酒中奢...      【C.两者都用】   \n",
       "..                                                 ...           ...   \n",
       "150  【A.品牌产品之间跨度大，比较新奇】,【B.人们想体验酒味冰淇淋是否会醉酒】,【C.对酒中奢...      【C.两者都用】   \n",
       "151  【A.品牌产品之间跨度大，比较新奇】,【B.人们想体验酒味冰淇淋是否会醉酒】,【E.盲目跟风...      【A.线下购买】   \n",
       "152                                 【A.品牌产品之间跨度大，比较新奇】      【C.两者都用】   \n",
       "153  【A.品牌产品之间跨度大，比较新奇】,【B.人们想体验酒味冰淇淋是否会醉酒】,【D.两个品牌...      【A.线下购买】   \n",
       "154  【A.品牌产品之间跨度大，比较新奇】,【B.人们想体验酒味冰淇淋是否会醉酒】,【C.对酒中奢...      【A.线下购买】   \n",
       "\n",
       "                           19.你认为茅台和蒙牛此次的联名会产生怎样的营销效果?  \\\n",
       "0    【A.明显提高茅台与蒙牛的知名度】,【B.拓展品牌的消费群体】,【C.增加产品的多样性】,【...   \n",
       "1    【A.明显提高茅台与蒙牛的知名度】,【C.增加产品的多样性】,【D.带给品牌更多的话题和关注...   \n",
       "2         【C.增加产品的多样性】,【E.风险大，冰淇淋的接受直接影响了品牌口碑容易流失原本客户】   \n",
       "3         【B.拓展品牌的消费群体】,【C.增加产品的多样性】,【D.带给品牌更多的话题和关注度】   \n",
       "4    【A.明显提高茅台与蒙牛的知名度】,【B.拓展品牌的消费群体】,【C.增加产品的多样性】,【...   \n",
       "..                                                 ...   \n",
       "150                【A.明显提高茅台与蒙牛的知名度】,【D.带给品牌更多的话题和关注度】   \n",
       "151  【A.明显提高茅台与蒙牛的知名度】,【E.风险大，冰淇淋的接受直接影响了品牌口碑容易流失原本客户】   \n",
       "152                    【E.风险大，冰淇淋的接受直接影响了品牌口碑容易流失原本客户】   \n",
       "153  【A.明显提高茅台与蒙牛的知名度】,【B.拓展品牌的消费群体】,【C.增加产品的多样性】,【...   \n",
       "154  【A.明显提高茅台与蒙牛的知名度】,【B.拓展品牌的消费群体】,【C.增加产品的多样性】,【...   \n",
       "\n",
       "                                    20.您希望在可以在哪些方面做出改进  \n",
       "0    【A.降低价格】,【B.丰富口味】,【C.扩大产品知名度】,【D.创新雪糕形状】,【E.增加...  \n",
       "1                                  【A.降低价格】,【E.增加线下专柜】  \n",
       "2                                          【C.扩大产品知名度】  \n",
       "3                                  【A.降低价格】,【E.增加线下专柜】  \n",
       "4    【A.降低价格】,【B.丰富口味】,【C.扩大产品知名度】,【D.创新雪糕形状】,【E.增加...  \n",
       "..                                                 ...  \n",
       "150                                  【A.降低价格】,【B.丰富口味】  \n",
       "151                                【A.降低价格】,【E.增加线下专柜】  \n",
       "152                              【D.创新雪糕形状】,【E.增加线下专柜】  \n",
       "153                     【A.降低价格】,【D.创新雪糕形状】,【E.增加线下专柜】  \n",
       "154                    【A.降低价格】,【C.扩大产品知名度】,【E.增加线下专柜】  \n",
       "\n",
       "[153 rows x 21 columns]"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#### 删除重复值\n",
    "df3 = df2.drop_duplicates(subset=['提交时间'],keep='first')\n",
    "df3"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>0</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>提交时间</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1.性别</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2.是否为大学生？</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3.年级</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4.年龄</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5.您是否购买过该产品？</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6.您不购买的理由是？</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7.您是否会选择再次购买？</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8.您不会再次购买的理由是？</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9.您选择再次购买的理由是？</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10.您会在什么季节购买茅台冰淇淋</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11.遇到品牌联名出新产品（如“茅台冰淇淋”），您会</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12.您一般会购买茅台冰淇淋的原因</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13.茅台冰淇淋的网络热搜会增加你的购买欲望吗？</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14.在购买时您主要考虑的因素是什么</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15.你对品牌联名推出的产品接受程度?</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16.您觉得茅台冰淇淋哪种促销方式最吸引您</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17.你认为茅台与蒙牛联名的冰淇淋火热的原因?</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18.您更倾向哪种购物体验</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19.你认为茅台和蒙牛此次的联名会产生怎样的营销效果?</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20.您希望在可以在哪些方面做出改进</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                                  0\n",
       "提交时间                         object\n",
       "1.性别                         object\n",
       "2.是否为大学生？                    object\n",
       "3.年级                         object\n",
       "4.年龄                         object\n",
       "5.您是否购买过该产品？                 object\n",
       "6.您不购买的理由是？                  object\n",
       "7.您是否会选择再次购买？                object\n",
       "8.您不会再次购买的理由是？               object\n",
       "9.您选择再次购买的理由是？               object\n",
       "10.您会在什么季节购买茅台冰淇淋            object\n",
       "11.遇到品牌联名出新产品（如“茅台冰淇淋”），您会   object\n",
       "12.您一般会购买茅台冰淇淋的原因            object\n",
       "13.茅台冰淇淋的网络热搜会增加你的购买欲望吗？     object\n",
       "14.在购买时您主要考虑的因素是什么           object\n",
       "15.你对品牌联名推出的产品接受程度?          object\n",
       "16.您觉得茅台冰淇淋哪种促销方式最吸引您        object\n",
       "17.你认为茅台与蒙牛联名的冰淇淋火热的原因?      object\n",
       "18.您更倾向哪种购物体验                object\n",
       "19.你认为茅台和蒙牛此次的联名会产生怎样的营销效果?  object\n",
       "20.您希望在可以在哪些方面做出改进           object"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df3.dtypes.to_frame()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "### 重命名变量\n",
    "df4 = df3.rename(columns={\n",
    "    '1.性别':'性别',\n",
    "    '2.是否为大学生？': '学历',\n",
    "    '3.年级':'年级',\n",
    "    '4.年龄':'年龄',\n",
    "    '5.您是否购买过该产品？':'是否购买过茅台冰淇淋',\n",
    "    '6.您不购买的理由是？':'不购买理由',\n",
    "    '8.您不会再次购买的理由是？':'不会再次购买理由',\n",
    "    '7.您是否会选择再次购买？':'是否再次购买',\n",
    "    '9.您选择再次购买的理由是？':'再次购买理由',\n",
    "    '11.遇到品牌联名出新产品（如“茅台冰淇淋”），您会':'购买行为习惯',\n",
    "    '10.您会在什么季节购买茅台冰淇淋':'选择购买季节',\n",
    "    '13.茅台冰淇淋的网络热搜会增加你的购买欲望吗？':'产品热度是否增加你的购买欲望',\n",
    "    '14.在购买时您主要考虑的因素是什么':'购买时的考虑因素',\n",
    "    '15.你对品牌联名推出的产品接受程度?':'此类产品的接受程度',\n",
    "    '16.您觉得茅台冰淇淋哪种促销方式最吸引您':'促销方式类型偏好',\n",
    "    '17.你认为茅台与蒙牛联名的冰淇淋火热的原因?':'受众评价联名火热原因',\n",
    "    '18.您更倾向哪种购物体验':'受众购物体验偏好',\n",
    "    '19.你认为茅台和蒙牛此次的联名会产生怎样的营销效果?':'受众自评感知联名营销效果',\n",
    "    '20.您希望在可以在哪些方面做出改进':'产品改进方面建议'\n",
    "})"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>提交时间</th>\n",
       "      <th>填写问卷时长</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2022/12/10 13:24:50</td>\n",
       "      <td>2022/12/10 13:24:50</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2022/12/10 08:41:54</td>\n",
       "      <td>2022/12/10 08:41:54</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2022/12/09 23:17:16</td>\n",
       "      <td>2022/12/09 23:17:16</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                  提交时间               填写问卷时长\n",
       "0  2022/12/10 13:24:50  2022/12/10 13:24:50\n",
       "1  2022/12/10 08:41:54  2022/12/10 08:41:54\n",
       "2  2022/12/09 23:17:16  2022/12/09 23:17:16"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "\"\"\" 重新生成变量 \"\"\"\n",
    "df4['填写问卷时长'] = df3['提交时间'].str.rstrip('秒')\n",
    "df4[['提交时间','填写问卷时长']].head(3)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [],
   "source": [
    "### 必要的数据转换\n",
    "df4['填写问卷时长'] = df4['提交时间'].str.rstrip('秒')\n",
    "df4['此类产品的接受程度'] = df4['此类产品的接受程度'].str.strip('○')\n",
    "df4['受众自评感知联名营销效果'] = df4['受众自评感知联名营销效果'].str.strip('○')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>0</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>提交时间</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1.性别</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2.是否为大学生？</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3.年级</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4.年龄</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5.您是否购买过该产品？</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6.您不购买的理由是？</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7.您是否会选择再次购买？</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8.您不会再次购买的理由是？</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9.您选择再次购买的理由是？</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10.您会在什么季节购买茅台冰淇淋</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11.遇到品牌联名出新产品（如“茅台冰淇淋”），您会</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12.您一般会购买茅台冰淇淋的原因</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13.茅台冰淇淋的网络热搜会增加你的购买欲望吗？</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14.在购买时您主要考虑的因素是什么</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15.你对品牌联名推出的产品接受程度?</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16.您觉得茅台冰淇淋哪种促销方式最吸引您</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17.你认为茅台与蒙牛联名的冰淇淋火热的原因?</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18.您更倾向哪种购物体验</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19.你认为茅台和蒙牛此次的联名会产生怎样的营销效果?</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20.您希望在可以在哪些方面做出改进</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                                  0\n",
       "提交时间                         object\n",
       "1.性别                         object\n",
       "2.是否为大学生？                    object\n",
       "3.年级                         object\n",
       "4.年龄                         object\n",
       "5.您是否购买过该产品？                 object\n",
       "6.您不购买的理由是？                  object\n",
       "7.您是否会选择再次购买？                object\n",
       "8.您不会再次购买的理由是？               object\n",
       "9.您选择再次购买的理由是？               object\n",
       "10.您会在什么季节购买茅台冰淇淋            object\n",
       "11.遇到品牌联名出新产品（如“茅台冰淇淋”），您会   object\n",
       "12.您一般会购买茅台冰淇淋的原因            object\n",
       "13.茅台冰淇淋的网络热搜会增加你的购买欲望吗？     object\n",
       "14.在购买时您主要考虑的因素是什么           object\n",
       "15.你对品牌联名推出的产品接受程度?          object\n",
       "16.您觉得茅台冰淇淋哪种促销方式最吸引您        object\n",
       "17.你认为茅台与蒙牛联名的冰淇淋火热的原因?      object\n",
       "18.您更倾向哪种购物体验                object\n",
       "19.你认为茅台和蒙牛此次的联名会产生怎样的营销效果?  object\n",
       "20.您希望在可以在哪些方面做出改进           object"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "### 变量类型检查\n",
    "\"\"\"查看变量类型\"\"\"\n",
    "df3.dtypes.to_frame()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "datetime.timedelta(seconds=100, microseconds=550000)"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "datetime.timedelta(seconds=100.55)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>0</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>提交时间</th>\n",
       "      <td>string</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>性别</th>\n",
       "      <td>category</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>学历</th>\n",
       "      <td>category</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>年级</th>\n",
       "      <td>category</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>年龄</th>\n",
       "      <td>category</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>是否购买过茅台冰淇淋</th>\n",
       "      <td>category</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>不购买理由</th>\n",
       "      <td>category</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>是否再次购买</th>\n",
       "      <td>category</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>不会再次购买理由</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>再次购买理由</th>\n",
       "      <td>category</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>选择购买季节</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>购买行为习惯</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12.您一般会购买茅台冰淇淋的原因</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>产品热度是否增加你的购买欲望</th>\n",
       "      <td>category</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>购买时的考虑因素</th>\n",
       "      <td>category</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>此类产品的接受程度</th>\n",
       "      <td>category</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>促销方式类型偏好</th>\n",
       "      <td>string</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>受众评价联名火热原因</th>\n",
       "      <td>category</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>受众购物体验偏好</th>\n",
       "      <td>category</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>受众自评感知联名营销效果</th>\n",
       "      <td>category</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>产品改进方面建议</th>\n",
       "      <td>category</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>填写问卷时长</th>\n",
       "      <td>object</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                          0\n",
       "提交时间                 string\n",
       "性别                 category\n",
       "学历                 category\n",
       "年级                 category\n",
       "年龄                 category\n",
       "是否购买过茅台冰淇淋         category\n",
       "不购买理由              category\n",
       "是否再次购买             category\n",
       "不会再次购买理由             object\n",
       "再次购买理由             category\n",
       "选择购买季节               object\n",
       "购买行为习惯               object\n",
       "12.您一般会购买茅台冰淇淋的原因    object\n",
       "产品热度是否增加你的购买欲望     category\n",
       "购买时的考虑因素           category\n",
       "此类产品的接受程度          category\n",
       "促销方式类型偏好             string\n",
       "受众评价联名火热原因         category\n",
       "受众购物体验偏好           category\n",
       "受众自评感知联名营销效果       category\n",
       "产品改进方面建议           category\n",
       "填写问卷时长               object"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "### 使用astypes方法设定变量的类型\n",
    "df5 = df4.astype({\n",
    "    '性别': 'category',\n",
    "    '提交时间': 'string',\n",
    "    '学历': 'category',\n",
    "    '性别': 'category',\n",
    "    '年级': 'category',\n",
    "    '年龄': 'category',\n",
    "    '是否购买过茅台冰淇淋': 'category',\n",
    "    '不购买理由': 'category',\n",
    "    '是否再次购买': 'category',\n",
    "    '再次购买理由': 'category',\n",
    "    '产品热度是否增加你的购买欲望': 'category',\n",
    "    '购买时的考虑因素': 'category',\n",
    "    '此类产品的接受程度': 'category',\n",
    "    '促销方式类型偏好': 'string',\n",
    "    '受众评价联名火热原因': 'category',\n",
    "    '受众购物体验偏好': 'category',\n",
    "    '受众自评感知联名营销效果': 'category',\n",
    "    '产品改进方面建议': 'category',\n",
    "})\n",
    "df5.dtypes.to_frame()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "count                     153\n",
       "unique                    153\n",
       "top       2022/12/10 13:24:50\n",
       "freq                        1\n",
       "Name: 填写问卷时长, dtype: object"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df5['填写问卷时长'].describe()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/vnd.plotly.v1+json": {
       "config": {
        "plotlyServerURL": "https://plot.ly"
       },
       "data": [
        {
         "alignmentgroup": "True",
         "hovertemplate": "填写问卷时长=%{y}<extra></extra>",
         "legendgroup": "",
         "marker": {
          "color": "#636efa"
         },
         "name": "",
         "notched": false,
         "offsetgroup": "",
         "orientation": "v",
         "showlegend": false,
         "type": "box",
         "x0": " ",
         "xaxis": "x",
         "y": [
          "2022/12/10 13:24:50",
          "2022/12/10 08:41:54",
          "2022/12/09 23:17:16",
          "2022/12/09 21:56:07",
          "2022/12/09 17:13:58",
          "2022/12/09 17:05:52",
          "2022/12/09 16:34:49",
          "2022/12/09 10:53:20",
          "2022/12/09 08:21:51",
          "2022/12/09 01:00:48",
          "2022/12/08 23:30:51",
          "2022/12/08 23:14:50",
          "2022/12/08 20:40:12",
          "2022/12/08 20:39:06",
          "2022/12/08 20:34:46",
          "2022/12/08 20:31:10",
          "2022/12/08 20:26:18",
          "2022/12/08 20:25:59",
          "2022/12/08 20:23:36",
          "2022/12/08 20:19:46",
          "2022/12/08 20:14:52",
          "2022/12/08 20:14:31",
          "2022/12/08 20:10:17",
          "2022/12/08 20:06:34",
          "2022/12/08 19:48:10",
          "2022/12/08 19:46:41",
          "2022/12/08 19:32:11",
          "2022/12/08 19:24:35",
          "2022/12/08 19:19:07",
          "2022/12/08 19:18:58",
          "2022/12/08 19:17:10",
          "2022/12/08 19:16:22",
          "2022/12/08 19:15:53",
          "2022/12/08 19:14:52",
          "2022/12/08 19:12:34",
          "2022/12/08 19:10:18",
          "2022/12/08 19:09:48",
          "2022/12/08 19:09:47",
          "2022/12/08 19:08:48",
          "2022/12/08 19:08:34",
          "2022/12/08 19:07:24",
          "2022/12/08 19:03:04",
          "2022/12/08 19:02:52",
          "2022/12/08 19:02:44",
          "2022/12/08 19:02:03",
          "2022/12/08 19:01:34",
          "2022/12/08 18:59:12",
          "2022/12/08 18:58:58",
          "2022/12/08 18:54:59",
          "2022/12/08 18:54:45",
          "2022/12/08 18:53:20",
          "2022/12/08 18:51:13",
          "2022/12/08 18:50:46",
          "2022/12/08 18:46:11",
          "2022/12/08 18:45:29",
          "2022/12/08 18:43:27",
          "2022/12/08 18:42:27",
          "2022/12/08 18:42:17",
          "2022/12/08 18:41:54",
          "2022/12/08 18:41:50",
          "2022/12/08 18:41:23",
          "2022/12/08 18:41:21",
          "2022/12/08 18:40:40",
          "2022/12/08 18:40:15",
          "2022/12/08 18:34:37",
          "2022/12/08 18:32:47",
          "2022/12/08 18:30:33",
          "2022/12/08 18:30:20",
          "2022/12/08 18:29:21",
          "2022/12/08 18:28:55",
          "2022/12/08 18:27:52",
          "2022/12/08 18:25:15",
          "2022/12/08 18:24:34",
          "2022/12/08 18:24:10",
          "2022/12/08 18:24:05",
          "2022/12/08 18:20:05",
          "2022/12/08 18:14:46",
          "2022/12/08 18:13:46",
          "2022/12/08 18:08:11",
          "2022/12/08 18:08:09",
          "2022/12/08 18:04:06",
          "2022/12/03 15:47:50",
          "2022/12/03 12:06:47",
          "2022/12/02 23:08:33",
          "2022/12/02 22:26:13",
          "2022/12/02 19:45:14",
          "2022/12/02 18:57:29",
          "2022/12/02 17:49:39",
          "2022/12/02 17:33:49",
          "2022/12/02 17:29:02",
          "2022/12/02 16:55:45",
          "2022/12/02 16:40:57",
          "2022/12/02 16:29:31",
          "2022/12/02 16:27:06",
          "2022/12/02 16:21:43",
          "2022/12/02 16:15:15",
          "2022/12/02 16:15:04",
          "2022/12/02 16:13:47",
          "2022/12/02 16:07:20",
          "2022/12/02 16:05:33",
          "2022/12/02 16:04:55",
          "2022/12/02 16:02:43",
          "2022/12/02 16:01:16",
          "2022/12/02 15:55:47",
          "2022/12/02 15:55:45",
          "2022/12/02 15:55:09",
          "2022/12/02 15:54:00",
          "2022/12/02 15:47:29",
          "2022/12/02 15:35:44",
          "2022/12/02 15:33:35",
          "2022/12/02 15:29:51",
          "2022/12/02 15:29:20",
          "2022/12/02 15:27:23",
          "2022/12/02 15:27:13",
          "2022/12/02 15:19:35",
          "2022/12/02 15:17:12",
          "2022/12/02 15:13:48",
          "2022/12/02 15:12:38",
          "2022/12/02 15:10:34",
          "2022/12/02 15:09:42",
          "2022/12/02 15:08:07",
          "2022/12/02 15:06:48",
          "2022/12/02 15:06:36",
          "2022/12/02 15:05:33",
          "2022/12/02 15:05:15",
          "2022/12/02 15:05:09",
          "2022/12/02 15:03:46",
          "2022/12/02 15:03:39",
          "2022/12/02 15:03:25",
          "2022/12/02 15:02:43",
          "2022/12/02 15:02:04",
          "2022/12/02 15:01:54",
          "2022/12/02 14:59:47",
          "2022/12/02 14:59:29",
          "2022/12/02 14:59:00",
          "2022/12/02 14:58:33",
          "2022/12/02 14:55:32",
          "2022/12/02 14:52:51",
          "2022/12/02 14:52:01",
          "2022/12/02 14:49:14",
          "2022/12/02 14:48:53",
          "2022/12/02 14:45:32",
          "2022/12/02 14:44:43",
          "2022/12/02 14:44:39",
          "2022/12/02 14:42:22",
          "2022/12/02 14:41:23",
          "2022/12/02 14:41:22",
          "2022/12/02 14:41:03",
          "2022/12/02 14:39:56",
          "2022/12/02 14:39:51",
          "2022/12/02 14:39:02",
          "2022/12/02 14:34:47",
          "2022/12/02 14:32:09"
         ],
         "y0": " ",
         "yaxis": "y"
        }
       ],
       "layout": {
        "boxmode": "group",
        "legend": {
         "tracegroupgap": 0
        },
        "margin": {
         "t": 60
        },
        "template": {
         "data": {
          "bar": [
           {
            "error_x": {
             "color": "#2a3f5f"
            },
            "error_y": {
             "color": "#2a3f5f"
            },
            "marker": {
             "line": {
              "color": "#E5ECF6",
              "width": 0.5
             },
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "bar"
           }
          ],
          "barpolar": [
           {
            "marker": {
             "line": {
              "color": "#E5ECF6",
              "width": 0.5
             },
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "barpolar"
           }
          ],
          "carpet": [
           {
            "aaxis": {
             "endlinecolor": "#2a3f5f",
             "gridcolor": "white",
             "linecolor": "white",
             "minorgridcolor": "white",
             "startlinecolor": "#2a3f5f"
            },
            "baxis": {
             "endlinecolor": "#2a3f5f",
             "gridcolor": "white",
             "linecolor": "white",
             "minorgridcolor": "white",
             "startlinecolor": "#2a3f5f"
            },
            "type": "carpet"
           }
          ],
          "choropleth": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "choropleth"
           }
          ],
          "contour": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "contour"
           }
          ],
          "contourcarpet": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "contourcarpet"
           }
          ],
          "heatmap": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "heatmap"
           }
          ],
          "heatmapgl": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "heatmapgl"
           }
          ],
          "histogram": [
           {
            "marker": {
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "histogram"
           }
          ],
          "histogram2d": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "histogram2d"
           }
          ],
          "histogram2dcontour": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "histogram2dcontour"
           }
          ],
          "mesh3d": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "mesh3d"
           }
          ],
          "parcoords": [
           {
            "line": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "parcoords"
           }
          ],
          "pie": [
           {
            "automargin": true,
            "type": "pie"
           }
          ],
          "scatter": [
           {
            "fillpattern": {
             "fillmode": "overlay",
             "size": 10,
             "solidity": 0.2
            },
            "type": "scatter"
           }
          ],
          "scatter3d": [
           {
            "line": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatter3d"
           }
          ],
          "scattercarpet": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattercarpet"
           }
          ],
          "scattergeo": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattergeo"
           }
          ],
          "scattergl": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattergl"
           }
          ],
          "scattermapbox": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattermapbox"
           }
          ],
          "scatterpolar": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterpolar"
           }
          ],
          "scatterpolargl": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterpolargl"
           }
          ],
          "scatterternary": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterternary"
           }
          ],
          "surface": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "surface"
           }
          ],
          "table": [
           {
            "cells": {
             "fill": {
              "color": "#EBF0F8"
             },
             "line": {
              "color": "white"
             }
            },
            "header": {
             "fill": {
              "color": "#C8D4E3"
             },
             "line": {
              "color": "white"
             }
            },
            "type": "table"
           }
          ]
         },
         "layout": {
          "annotationdefaults": {
           "arrowcolor": "#2a3f5f",
           "arrowhead": 0,
           "arrowwidth": 1
          },
          "autotypenumbers": "strict",
          "coloraxis": {
           "colorbar": {
            "outlinewidth": 0,
            "ticks": ""
           }
          },
          "colorscale": {
           "diverging": [
            [
             0,
             "#8e0152"
            ],
            [
             0.1,
             "#c51b7d"
            ],
            [
             0.2,
             "#de77ae"
            ],
            [
             0.3,
             "#f1b6da"
            ],
            [
             0.4,
             "#fde0ef"
            ],
            [
             0.5,
             "#f7f7f7"
            ],
            [
             0.6,
             "#e6f5d0"
            ],
            [
             0.7,
             "#b8e186"
            ],
            [
             0.8,
             "#7fbc41"
            ],
            [
             0.9,
             "#4d9221"
            ],
            [
             1,
             "#276419"
            ]
           ],
           "sequential": [
            [
             0,
             "#0d0887"
            ],
            [
             0.1111111111111111,
             "#46039f"
            ],
            [
             0.2222222222222222,
             "#7201a8"
            ],
            [
             0.3333333333333333,
             "#9c179e"
            ],
            [
             0.4444444444444444,
             "#bd3786"
            ],
            [
             0.5555555555555556,
             "#d8576b"
            ],
            [
             0.6666666666666666,
             "#ed7953"
            ],
            [
             0.7777777777777778,
             "#fb9f3a"
            ],
            [
             0.8888888888888888,
             "#fdca26"
            ],
            [
             1,
             "#f0f921"
            ]
           ],
           "sequentialminus": [
            [
             0,
             "#0d0887"
            ],
            [
             0.1111111111111111,
             "#46039f"
            ],
            [
             0.2222222222222222,
             "#7201a8"
            ],
            [
             0.3333333333333333,
             "#9c179e"
            ],
            [
             0.4444444444444444,
             "#bd3786"
            ],
            [
             0.5555555555555556,
             "#d8576b"
            ],
            [
             0.6666666666666666,
             "#ed7953"
            ],
            [
             0.7777777777777778,
             "#fb9f3a"
            ],
            [
             0.8888888888888888,
             "#fdca26"
            ],
            [
             1,
             "#f0f921"
            ]
           ]
          },
          "colorway": [
           "#636efa",
           "#EF553B",
           "#00cc96",
           "#ab63fa",
           "#FFA15A",
           "#19d3f3",
           "#FF6692",
           "#B6E880",
           "#FF97FF",
           "#FECB52"
          ],
          "font": {
           "color": "#2a3f5f"
          },
          "geo": {
           "bgcolor": "white",
           "lakecolor": "white",
           "landcolor": "#E5ECF6",
           "showlakes": true,
           "showland": true,
           "subunitcolor": "white"
          },
          "hoverlabel": {
           "align": "left"
          },
          "hovermode": "closest",
          "mapbox": {
           "style": "light"
          },
          "paper_bgcolor": "white",
          "plot_bgcolor": "#E5ECF6",
          "polar": {
           "angularaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "bgcolor": "#E5ECF6",
           "radialaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           }
          },
          "scene": {
           "xaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           },
           "yaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           },
           "zaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           }
          },
          "shapedefaults": {
           "line": {
            "color": "#2a3f5f"
           }
          },
          "ternary": {
           "aaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "baxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "bgcolor": "#E5ECF6",
           "caxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           }
          },
          "title": {
           "x": 0.05
          },
          "xaxis": {
           "automargin": true,
           "gridcolor": "white",
           "linecolor": "white",
           "ticks": "",
           "title": {
            "standoff": 15
           },
           "zerolinecolor": "white",
           "zerolinewidth": 2
          },
          "yaxis": {
           "automargin": true,
           "gridcolor": "white",
           "linecolor": "white",
           "ticks": "",
           "title": {
            "standoff": 15
           },
           "zerolinecolor": "white",
           "zerolinewidth": 2
          }
         }
        },
        "xaxis": {
         "anchor": "y",
         "domain": [
          0,
          1
         ]
        },
        "yaxis": {
         "anchor": "x",
         "domain": [
          0,
          1
         ],
         "title": {
          "text": "填写问卷时长"
         }
        }
       }
      }
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "fig = px.box(df5, y=\"填写问卷时长\")\n",
    "fig.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/vnd.plotly.v1+json": {
       "config": {
        "plotlyServerURL": "https://plot.ly"
       },
       "data": [
        {
         "alignmentgroup": "True",
         "bingroup": "x",
         "hovertemplate": "填写问卷时长=%{x}<br>count=%{y}<extra></extra>",
         "legendgroup": "",
         "marker": {
          "color": "#636efa",
          "pattern": {
           "shape": ""
          }
         },
         "name": "",
         "offsetgroup": "",
         "orientation": "v",
         "showlegend": false,
         "type": "histogram",
         "x": [
          "2022/12/10 13:24:50",
          "2022/12/10 08:41:54",
          "2022/12/09 23:17:16",
          "2022/12/09 21:56:07",
          "2022/12/09 17:13:58",
          "2022/12/09 17:05:52",
          "2022/12/09 16:34:49",
          "2022/12/09 10:53:20",
          "2022/12/09 08:21:51",
          "2022/12/09 01:00:48",
          "2022/12/08 23:30:51",
          "2022/12/08 23:14:50",
          "2022/12/08 20:40:12",
          "2022/12/08 20:39:06",
          "2022/12/08 20:34:46",
          "2022/12/08 20:31:10",
          "2022/12/08 20:26:18",
          "2022/12/08 20:25:59",
          "2022/12/08 20:23:36",
          "2022/12/08 20:19:46",
          "2022/12/08 20:14:52",
          "2022/12/08 20:14:31",
          "2022/12/08 20:10:17",
          "2022/12/08 20:06:34",
          "2022/12/08 19:48:10",
          "2022/12/08 19:46:41",
          "2022/12/08 19:32:11",
          "2022/12/08 19:24:35",
          "2022/12/08 19:19:07",
          "2022/12/08 19:18:58",
          "2022/12/08 19:17:10",
          "2022/12/08 19:16:22",
          "2022/12/08 19:15:53",
          "2022/12/08 19:14:52",
          "2022/12/08 19:12:34",
          "2022/12/08 19:10:18",
          "2022/12/08 19:09:48",
          "2022/12/08 19:09:47",
          "2022/12/08 19:08:48",
          "2022/12/08 19:08:34",
          "2022/12/08 19:07:24",
          "2022/12/08 19:03:04",
          "2022/12/08 19:02:52",
          "2022/12/08 19:02:44",
          "2022/12/08 19:02:03",
          "2022/12/08 19:01:34",
          "2022/12/08 18:59:12",
          "2022/12/08 18:58:58",
          "2022/12/08 18:54:59",
          "2022/12/08 18:54:45",
          "2022/12/08 18:53:20",
          "2022/12/08 18:51:13",
          "2022/12/08 18:50:46",
          "2022/12/08 18:46:11",
          "2022/12/08 18:45:29",
          "2022/12/08 18:43:27",
          "2022/12/08 18:42:27",
          "2022/12/08 18:42:17",
          "2022/12/08 18:41:54",
          "2022/12/08 18:41:50",
          "2022/12/08 18:41:23",
          "2022/12/08 18:41:21",
          "2022/12/08 18:40:40",
          "2022/12/08 18:40:15",
          "2022/12/08 18:34:37",
          "2022/12/08 18:32:47",
          "2022/12/08 18:30:33",
          "2022/12/08 18:30:20",
          "2022/12/08 18:29:21",
          "2022/12/08 18:28:55",
          "2022/12/08 18:27:52",
          "2022/12/08 18:25:15",
          "2022/12/08 18:24:34",
          "2022/12/08 18:24:10",
          "2022/12/08 18:24:05",
          "2022/12/08 18:20:05",
          "2022/12/08 18:14:46",
          "2022/12/08 18:13:46",
          "2022/12/08 18:08:11",
          "2022/12/08 18:08:09",
          "2022/12/08 18:04:06",
          "2022/12/03 15:47:50",
          "2022/12/03 12:06:47",
          "2022/12/02 23:08:33",
          "2022/12/02 22:26:13",
          "2022/12/02 19:45:14",
          "2022/12/02 18:57:29",
          "2022/12/02 17:49:39",
          "2022/12/02 17:33:49",
          "2022/12/02 17:29:02",
          "2022/12/02 16:55:45",
          "2022/12/02 16:40:57",
          "2022/12/02 16:29:31",
          "2022/12/02 16:27:06",
          "2022/12/02 16:21:43",
          "2022/12/02 16:15:15",
          "2022/12/02 16:15:04",
          "2022/12/02 16:13:47",
          "2022/12/02 16:07:20",
          "2022/12/02 16:05:33",
          "2022/12/02 16:04:55",
          "2022/12/02 16:02:43",
          "2022/12/02 16:01:16",
          "2022/12/02 15:55:47",
          "2022/12/02 15:55:45",
          "2022/12/02 15:55:09",
          "2022/12/02 15:54:00",
          "2022/12/02 15:47:29",
          "2022/12/02 15:35:44",
          "2022/12/02 15:33:35",
          "2022/12/02 15:29:51",
          "2022/12/02 15:29:20",
          "2022/12/02 15:27:23",
          "2022/12/02 15:27:13",
          "2022/12/02 15:19:35",
          "2022/12/02 15:17:12",
          "2022/12/02 15:13:48",
          "2022/12/02 15:12:38",
          "2022/12/02 15:10:34",
          "2022/12/02 15:09:42",
          "2022/12/02 15:08:07",
          "2022/12/02 15:06:48",
          "2022/12/02 15:06:36",
          "2022/12/02 15:05:33",
          "2022/12/02 15:05:15",
          "2022/12/02 15:05:09",
          "2022/12/02 15:03:46",
          "2022/12/02 15:03:39",
          "2022/12/02 15:03:25",
          "2022/12/02 15:02:43",
          "2022/12/02 15:02:04",
          "2022/12/02 15:01:54",
          "2022/12/02 14:59:47",
          "2022/12/02 14:59:29",
          "2022/12/02 14:59:00",
          "2022/12/02 14:58:33",
          "2022/12/02 14:55:32",
          "2022/12/02 14:52:51",
          "2022/12/02 14:52:01",
          "2022/12/02 14:49:14",
          "2022/12/02 14:48:53",
          "2022/12/02 14:45:32",
          "2022/12/02 14:44:43",
          "2022/12/02 14:44:39",
          "2022/12/02 14:42:22",
          "2022/12/02 14:41:23",
          "2022/12/02 14:41:22",
          "2022/12/02 14:41:03",
          "2022/12/02 14:39:56",
          "2022/12/02 14:39:51",
          "2022/12/02 14:39:02",
          "2022/12/02 14:34:47",
          "2022/12/02 14:32:09"
         ],
         "xaxis": "x",
         "yaxis": "y"
        }
       ],
       "layout": {
        "barmode": "relative",
        "legend": {
         "tracegroupgap": 0
        },
        "margin": {
         "t": 60
        },
        "template": {
         "data": {
          "bar": [
           {
            "error_x": {
             "color": "#2a3f5f"
            },
            "error_y": {
             "color": "#2a3f5f"
            },
            "marker": {
             "line": {
              "color": "#E5ECF6",
              "width": 0.5
             },
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "bar"
           }
          ],
          "barpolar": [
           {
            "marker": {
             "line": {
              "color": "#E5ECF6",
              "width": 0.5
             },
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "barpolar"
           }
          ],
          "carpet": [
           {
            "aaxis": {
             "endlinecolor": "#2a3f5f",
             "gridcolor": "white",
             "linecolor": "white",
             "minorgridcolor": "white",
             "startlinecolor": "#2a3f5f"
            },
            "baxis": {
             "endlinecolor": "#2a3f5f",
             "gridcolor": "white",
             "linecolor": "white",
             "minorgridcolor": "white",
             "startlinecolor": "#2a3f5f"
            },
            "type": "carpet"
           }
          ],
          "choropleth": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "choropleth"
           }
          ],
          "contour": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "contour"
           }
          ],
          "contourcarpet": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "contourcarpet"
           }
          ],
          "heatmap": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "heatmap"
           }
          ],
          "heatmapgl": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "heatmapgl"
           }
          ],
          "histogram": [
           {
            "marker": {
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "histogram"
           }
          ],
          "histogram2d": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "histogram2d"
           }
          ],
          "histogram2dcontour": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "histogram2dcontour"
           }
          ],
          "mesh3d": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "mesh3d"
           }
          ],
          "parcoords": [
           {
            "line": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "parcoords"
           }
          ],
          "pie": [
           {
            "automargin": true,
            "type": "pie"
           }
          ],
          "scatter": [
           {
            "fillpattern": {
             "fillmode": "overlay",
             "size": 10,
             "solidity": 0.2
            },
            "type": "scatter"
           }
          ],
          "scatter3d": [
           {
            "line": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatter3d"
           }
          ],
          "scattercarpet": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattercarpet"
           }
          ],
          "scattergeo": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattergeo"
           }
          ],
          "scattergl": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattergl"
           }
          ],
          "scattermapbox": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattermapbox"
           }
          ],
          "scatterpolar": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterpolar"
           }
          ],
          "scatterpolargl": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterpolargl"
           }
          ],
          "scatterternary": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterternary"
           }
          ],
          "surface": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "surface"
           }
          ],
          "table": [
           {
            "cells": {
             "fill": {
              "color": "#EBF0F8"
             },
             "line": {
              "color": "white"
             }
            },
            "header": {
             "fill": {
              "color": "#C8D4E3"
             },
             "line": {
              "color": "white"
             }
            },
            "type": "table"
           }
          ]
         },
         "layout": {
          "annotationdefaults": {
           "arrowcolor": "#2a3f5f",
           "arrowhead": 0,
           "arrowwidth": 1
          },
          "autotypenumbers": "strict",
          "coloraxis": {
           "colorbar": {
            "outlinewidth": 0,
            "ticks": ""
           }
          },
          "colorscale": {
           "diverging": [
            [
             0,
             "#8e0152"
            ],
            [
             0.1,
             "#c51b7d"
            ],
            [
             0.2,
             "#de77ae"
            ],
            [
             0.3,
             "#f1b6da"
            ],
            [
             0.4,
             "#fde0ef"
            ],
            [
             0.5,
             "#f7f7f7"
            ],
            [
             0.6,
             "#e6f5d0"
            ],
            [
             0.7,
             "#b8e186"
            ],
            [
             0.8,
             "#7fbc41"
            ],
            [
             0.9,
             "#4d9221"
            ],
            [
             1,
             "#276419"
            ]
           ],
           "sequential": [
            [
             0,
             "#0d0887"
            ],
            [
             0.1111111111111111,
             "#46039f"
            ],
            [
             0.2222222222222222,
             "#7201a8"
            ],
            [
             0.3333333333333333,
             "#9c179e"
            ],
            [
             0.4444444444444444,
             "#bd3786"
            ],
            [
             0.5555555555555556,
             "#d8576b"
            ],
            [
             0.6666666666666666,
             "#ed7953"
            ],
            [
             0.7777777777777778,
             "#fb9f3a"
            ],
            [
             0.8888888888888888,
             "#fdca26"
            ],
            [
             1,
             "#f0f921"
            ]
           ],
           "sequentialminus": [
            [
             0,
             "#0d0887"
            ],
            [
             0.1111111111111111,
             "#46039f"
            ],
            [
             0.2222222222222222,
             "#7201a8"
            ],
            [
             0.3333333333333333,
             "#9c179e"
            ],
            [
             0.4444444444444444,
             "#bd3786"
            ],
            [
             0.5555555555555556,
             "#d8576b"
            ],
            [
             0.6666666666666666,
             "#ed7953"
            ],
            [
             0.7777777777777778,
             "#fb9f3a"
            ],
            [
             0.8888888888888888,
             "#fdca26"
            ],
            [
             1,
             "#f0f921"
            ]
           ]
          },
          "colorway": [
           "#636efa",
           "#EF553B",
           "#00cc96",
           "#ab63fa",
           "#FFA15A",
           "#19d3f3",
           "#FF6692",
           "#B6E880",
           "#FF97FF",
           "#FECB52"
          ],
          "font": {
           "color": "#2a3f5f"
          },
          "geo": {
           "bgcolor": "white",
           "lakecolor": "white",
           "landcolor": "#E5ECF6",
           "showlakes": true,
           "showland": true,
           "subunitcolor": "white"
          },
          "hoverlabel": {
           "align": "left"
          },
          "hovermode": "closest",
          "mapbox": {
           "style": "light"
          },
          "paper_bgcolor": "white",
          "plot_bgcolor": "#E5ECF6",
          "polar": {
           "angularaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "bgcolor": "#E5ECF6",
           "radialaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           }
          },
          "scene": {
           "xaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           },
           "yaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           },
           "zaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           }
          },
          "shapedefaults": {
           "line": {
            "color": "#2a3f5f"
           }
          },
          "ternary": {
           "aaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "baxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "bgcolor": "#E5ECF6",
           "caxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           }
          },
          "title": {
           "x": 0.05
          },
          "xaxis": {
           "automargin": true,
           "gridcolor": "white",
           "linecolor": "white",
           "ticks": "",
           "title": {
            "standoff": 15
           },
           "zerolinecolor": "white",
           "zerolinewidth": 2
          },
          "yaxis": {
           "automargin": true,
           "gridcolor": "white",
           "linecolor": "white",
           "ticks": "",
           "title": {
            "standoff": 15
           },
           "zerolinecolor": "white",
           "zerolinewidth": 2
          }
         }
        },
        "xaxis": {
         "anchor": "y",
         "domain": [
          0,
          1
         ],
         "title": {
          "text": "填写问卷时长"
         }
        },
        "yaxis": {
         "anchor": "x",
         "domain": [
          0,
          1
         ],
         "title": {
          "text": "count"
         }
        }
       }
      }
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "fig = px.histogram(df5, x=\"填写问卷时长\")\n",
    "fig.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [],
   "source": [
    "\"\"\" 列出所有类别变量取值 \"\"\"\n",
    "mytools.print_all_cats(df5)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [],
   "source": [
    "mytools.print_all_int(df5)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [],
   "source": [
    "### 数据清理完毕\n",
    "df = df5.copy()"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 样本背景\n",
    "本次描述性研究的样本背景变量只有一个，即性别，将样本的性别比例与总体的性别比例进行对比，可进行样本质量的评估。\n",
    "小组样本的数据收集以用腾讯问卷网发放问卷，在12月2日发放，12月10日收集整理，共收集了184个样本，有效样本155个。"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 推论统计"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "98.70967741935483"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "样本量 = df1.shape[0]\n",
    "有效样本量 = df.shape[0]\n",
    "有效回收率 = 有效样本量/样本量 * 100\n",
    "# 有效回收率在50%以上就可以接收。\n",
    "有效回收率"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>性别</th>\n",
       "      <th>个数</th>\n",
       "      <th>百分比</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>【B.女】</td>\n",
       "      <td>112</td>\n",
       "      <td>73.2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>【A.男】</td>\n",
       "      <td>41</td>\n",
       "      <td>26.8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>总和</td>\n",
       "      <td>153</td>\n",
       "      <td>100.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "      性别   个数    百分比\n",
       "0  【B.女】  112   73.2\n",
       "1  【A.男】   41   26.8\n",
       "2     总和  153  100.0"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "### 样本特征（性别）与总体特征的对比\n",
    "mytools.gen_percent_table(df,'性别')"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 样本质量评估\n",
    "样本发放过程是随机发放，样本与总体共有特征来评估样本的质量，样本中男女比例为73:27，与总体中的51:49有差距，因发放样本渠道是朋友圈和微信，渠道单一，样本收集量较小，朋友圈男女比例不同的原因，导致样本中性别出现了上述偏差，但样本是随机发放，也符合样本发放的主体大学生范围，故可认为样本质量较好。"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 样本特征分析\n",
    "本次研究中，相关的题目为：第11题：\"购买行为习惯\"、第6题\"选择购买季节\"等等，来了解大学生对茅台冰淇淋这个产品的消费态度与行为习惯\n",
    "\n",
    "## 样本基本态度\n",
    "样本中的基本态度，相关题目是如：\"此类产品的接受程度\"、\"受众自评感知联名营销效果\"等等，数据显示的样本总体对产品是看好的。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "dtype('O')"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 确保变量类型合适\n",
    "df['购买行为习惯'].dtype"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "dtype('O')"
      ]
     },
     "execution_count": 23,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df['选择购买季节'].dtype"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>选择购买季节</th>\n",
       "      <th>个数</th>\n",
       "      <th>百分比</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>【E.不论季节】</td>\n",
       "      <td>62</td>\n",
       "      <td>40.52</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>【B.夏季】</td>\n",
       "      <td>46</td>\n",
       "      <td>30.07</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>【A.春季】,【B.夏季】,【C.秋季】,【D.冬季】</td>\n",
       "      <td>1</td>\n",
       "      <td>0.65</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>【A.春季】,【B.夏季】,【C.秋季】,【D.冬季】,【E.不论季节】</td>\n",
       "      <td>7</td>\n",
       "      <td>4.58</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>【B.夏季】,【C.秋季】</td>\n",
       "      <td>12</td>\n",
       "      <td>7.84</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>【A.春季】,【E.不论季节】</td>\n",
       "      <td>1</td>\n",
       "      <td>0.65</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>【A.春季】,【B.夏季】,【C.秋季】</td>\n",
       "      <td>3</td>\n",
       "      <td>1.96</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>【D.冬季】</td>\n",
       "      <td>5</td>\n",
       "      <td>3.27</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>【C.秋季】,【D.冬季】</td>\n",
       "      <td>1</td>\n",
       "      <td>0.65</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>【B.夏季】,【E.不论季节】</td>\n",
       "      <td>5</td>\n",
       "      <td>3.27</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>【A.春季】,【B.夏季】</td>\n",
       "      <td>2</td>\n",
       "      <td>1.31</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>【A.春季】</td>\n",
       "      <td>4</td>\n",
       "      <td>2.61</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>【B.夏季】,【C.秋季】,【D.冬季】</td>\n",
       "      <td>1</td>\n",
       "      <td>0.65</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>【D.冬季】,【E.不论季节】</td>\n",
       "      <td>1</td>\n",
       "      <td>0.65</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>【B.夏季】,【D.冬季】</td>\n",
       "      <td>1</td>\n",
       "      <td>0.65</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>【C.秋季】</td>\n",
       "      <td>1</td>\n",
       "      <td>0.65</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>总和</td>\n",
       "      <td>153</td>\n",
       "      <td>100.00</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                                  选择购买季节   个数     百分比\n",
       "0                               【E.不论季节】   62   40.52\n",
       "1                                 【B.夏季】   46   30.07\n",
       "2            【A.春季】,【B.夏季】,【C.秋季】,【D.冬季】    1    0.65\n",
       "3   【A.春季】,【B.夏季】,【C.秋季】,【D.冬季】,【E.不论季节】    7    4.58\n",
       "4                          【B.夏季】,【C.秋季】   12    7.84\n",
       "5                        【A.春季】,【E.不论季节】    1    0.65\n",
       "6                   【A.春季】,【B.夏季】,【C.秋季】    3    1.96\n",
       "7                                 【D.冬季】    5    3.27\n",
       "8                          【C.秋季】,【D.冬季】    1    0.65\n",
       "9                        【B.夏季】,【E.不论季节】    5    3.27\n",
       "10                         【A.春季】,【B.夏季】    2    1.31\n",
       "11                                【A.春季】    4    2.61\n",
       "12                  【B.夏季】,【C.秋季】,【D.冬季】    1    0.65\n",
       "13                       【D.冬季】,【E.不论季节】    1    0.65\n",
       "14                         【B.夏季】,【D.冬季】    1    0.65\n",
       "15                                【C.秋季】    1    0.65\n",
       "16                                    总和  153  100.00"
      ]
     },
     "execution_count": 24,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "mytools.gen_percent_table(df,'选择购买季节',sort=False)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/vnd.plotly.v1+json": {
       "config": {
        "plotlyServerURL": "https://plot.ly"
       },
       "data": [
        {
         "alignmentgroup": "True",
         "hovertemplate": "选择购买季节=%{x}<br>count=%{y}<extra></extra>",
         "legendgroup": "",
         "marker": {
          "color": "#636efa",
          "pattern": {
           "shape": ""
          }
         },
         "name": "",
         "offsetgroup": "",
         "orientation": "v",
         "showlegend": false,
         "textposition": "auto",
         "type": "bar",
         "x": [
          "【E.不论季节】",
          "【B.夏季】",
          "【E.不论季节】",
          "【E.不论季节】",
          "【A.春季】,【B.夏季】,【C.秋季】,【D.冬季】",
          "【B.夏季】",
          "【B.夏季】",
          "【A.春季】,【B.夏季】,【C.秋季】,【D.冬季】,【E.不论季节】",
          "【B.夏季】,【C.秋季】",
          "【B.夏季】,【C.秋季】",
          "【B.夏季】",
          "【A.春季】,【E.不论季节】",
          "【B.夏季】",
          "【E.不论季节】",
          "【A.春季】,【B.夏季】,【C.秋季】",
          "【B.夏季】,【C.秋季】",
          "【D.冬季】",
          "【C.秋季】,【D.冬季】",
          "【E.不论季节】",
          "【E.不论季节】",
          "【E.不论季节】",
          "【B.夏季】",
          "【A.春季】,【B.夏季】,【C.秋季】,【D.冬季】,【E.不论季节】",
          "【B.夏季】,【E.不论季节】",
          "【E.不论季节】",
          "【E.不论季节】",
          "【D.冬季】",
          "【A.春季】,【B.夏季】,【C.秋季】,【D.冬季】,【E.不论季节】",
          "【A.春季】,【B.夏季】",
          "【B.夏季】",
          "【A.春季】,【B.夏季】,【C.秋季】,【D.冬季】,【E.不论季节】",
          "【B.夏季】,【C.秋季】",
          "【A.春季】,【B.夏季】,【C.秋季】",
          "【A.春季】,【B.夏季】,【C.秋季】,【D.冬季】,【E.不论季节】",
          "【B.夏季】",
          "【B.夏季】,【C.秋季】",
          "【B.夏季】",
          "【E.不论季节】",
          "【E.不论季节】",
          "【E.不论季节】",
          "【E.不论季节】",
          "【B.夏季】",
          "【B.夏季】,【C.秋季】",
          "【E.不论季节】",
          "【E.不论季节】",
          "【B.夏季】",
          "【B.夏季】",
          "【E.不论季节】",
          "【E.不论季节】",
          "【E.不论季节】",
          "【E.不论季节】",
          "【B.夏季】",
          "【E.不论季节】",
          "【E.不论季节】",
          "【B.夏季】",
          "【B.夏季】",
          "【B.夏季】",
          "【B.夏季】",
          "【B.夏季】",
          "【B.夏季】",
          "【B.夏季】,【E.不论季节】",
          "【E.不论季节】",
          "【B.夏季】",
          "【B.夏季】",
          "【E.不论季节】",
          "【E.不论季节】",
          "【B.夏季】",
          "【B.夏季】",
          "【B.夏季】",
          "【E.不论季节】",
          "【B.夏季】",
          "【A.春季】",
          "【B.夏季】",
          "【B.夏季】",
          "【E.不论季节】",
          "【B.夏季】",
          "【B.夏季】",
          "【E.不论季节】",
          "【E.不论季节】",
          "【D.冬季】",
          "【A.春季】",
          "【E.不论季节】",
          "【B.夏季】",
          "【B.夏季】,【C.秋季】",
          "【E.不论季节】",
          "【B.夏季】,【C.秋季】",
          "【E.不论季节】",
          "【A.春季】",
          "【E.不论季节】",
          "【B.夏季】",
          "【E.不论季节】",
          "【E.不论季节】",
          "【E.不论季节】",
          "【B.夏季】",
          "【B.夏季】,【C.秋季】",
          "【B.夏季】,【E.不论季节】",
          "【E.不论季节】",
          "【E.不论季节】",
          "【A.春季】,【B.夏季】,【C.秋季】",
          "【E.不论季节】",
          "【E.不论季节】",
          "【E.不论季节】",
          "【B.夏季】,【C.秋季】",
          "【B.夏季】,【C.秋季】,【D.冬季】",
          "【A.春季】,【B.夏季】,【C.秋季】,【D.冬季】,【E.不论季节】",
          "【B.夏季】",
          "【B.夏季】",
          "【E.不论季节】",
          "【B.夏季】",
          "【D.冬季】,【E.不论季节】",
          "【A.春季】,【B.夏季】,【C.秋季】,【D.冬季】,【E.不论季节】",
          "【D.冬季】",
          "【B.夏季】",
          "【B.夏季】",
          "【E.不论季节】",
          "【E.不论季节】",
          "【E.不论季节】",
          "【B.夏季】",
          "【E.不论季节】",
          "【B.夏季】",
          "【E.不论季节】",
          "【B.夏季】,【C.秋季】",
          "【E.不论季节】",
          "【E.不论季节】",
          "【E.不论季节】",
          "【E.不论季节】",
          "【E.不论季节】",
          "【B.夏季】",
          "【E.不论季节】",
          "【B.夏季】,【E.不论季节】",
          "【E.不论季节】",
          "【B.夏季】",
          "【B.夏季】,【E.不论季节】",
          "【B.夏季】",
          "【B.夏季】,【C.秋季】",
          "【A.春季】",
          "【E.不论季节】",
          "【E.不论季节】",
          "【E.不论季节】",
          "【D.冬季】",
          "【B.夏季】",
          "【B.夏季】,【D.冬季】",
          "【E.不论季节】",
          "【E.不论季节】",
          "【E.不论季节】",
          "【B.夏季】",
          "【E.不论季节】",
          "【B.夏季】",
          "【E.不论季节】",
          "【B.夏季】",
          "【E.不论季节】",
          "【C.秋季】",
          "【A.春季】,【B.夏季】"
         ],
         "xaxis": "x",
         "y": [
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1
         ],
         "yaxis": "y"
        }
       ],
       "layout": {
        "barmode": "relative",
        "legend": {
         "tracegroupgap": 0
        },
        "margin": {
         "t": 60
        },
        "template": {
         "data": {
          "bar": [
           {
            "error_x": {
             "color": "#2a3f5f"
            },
            "error_y": {
             "color": "#2a3f5f"
            },
            "marker": {
             "line": {
              "color": "#E5ECF6",
              "width": 0.5
             },
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "bar"
           }
          ],
          "barpolar": [
           {
            "marker": {
             "line": {
              "color": "#E5ECF6",
              "width": 0.5
             },
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "barpolar"
           }
          ],
          "carpet": [
           {
            "aaxis": {
             "endlinecolor": "#2a3f5f",
             "gridcolor": "white",
             "linecolor": "white",
             "minorgridcolor": "white",
             "startlinecolor": "#2a3f5f"
            },
            "baxis": {
             "endlinecolor": "#2a3f5f",
             "gridcolor": "white",
             "linecolor": "white",
             "minorgridcolor": "white",
             "startlinecolor": "#2a3f5f"
            },
            "type": "carpet"
           }
          ],
          "choropleth": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "choropleth"
           }
          ],
          "contour": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "contour"
           }
          ],
          "contourcarpet": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "contourcarpet"
           }
          ],
          "heatmap": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "heatmap"
           }
          ],
          "heatmapgl": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "heatmapgl"
           }
          ],
          "histogram": [
           {
            "marker": {
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "histogram"
           }
          ],
          "histogram2d": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "histogram2d"
           }
          ],
          "histogram2dcontour": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "histogram2dcontour"
           }
          ],
          "mesh3d": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "mesh3d"
           }
          ],
          "parcoords": [
           {
            "line": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "parcoords"
           }
          ],
          "pie": [
           {
            "automargin": true,
            "type": "pie"
           }
          ],
          "scatter": [
           {
            "fillpattern": {
             "fillmode": "overlay",
             "size": 10,
             "solidity": 0.2
            },
            "type": "scatter"
           }
          ],
          "scatter3d": [
           {
            "line": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatter3d"
           }
          ],
          "scattercarpet": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattercarpet"
           }
          ],
          "scattergeo": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattergeo"
           }
          ],
          "scattergl": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattergl"
           }
          ],
          "scattermapbox": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattermapbox"
           }
          ],
          "scatterpolar": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterpolar"
           }
          ],
          "scatterpolargl": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterpolargl"
           }
          ],
          "scatterternary": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterternary"
           }
          ],
          "surface": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "surface"
           }
          ],
          "table": [
           {
            "cells": {
             "fill": {
              "color": "#EBF0F8"
             },
             "line": {
              "color": "white"
             }
            },
            "header": {
             "fill": {
              "color": "#C8D4E3"
             },
             "line": {
              "color": "white"
             }
            },
            "type": "table"
           }
          ]
         },
         "layout": {
          "annotationdefaults": {
           "arrowcolor": "#2a3f5f",
           "arrowhead": 0,
           "arrowwidth": 1
          },
          "autotypenumbers": "strict",
          "coloraxis": {
           "colorbar": {
            "outlinewidth": 0,
            "ticks": ""
           }
          },
          "colorscale": {
           "diverging": [
            [
             0,
             "#8e0152"
            ],
            [
             0.1,
             "#c51b7d"
            ],
            [
             0.2,
             "#de77ae"
            ],
            [
             0.3,
             "#f1b6da"
            ],
            [
             0.4,
             "#fde0ef"
            ],
            [
             0.5,
             "#f7f7f7"
            ],
            [
             0.6,
             "#e6f5d0"
            ],
            [
             0.7,
             "#b8e186"
            ],
            [
             0.8,
             "#7fbc41"
            ],
            [
             0.9,
             "#4d9221"
            ],
            [
             1,
             "#276419"
            ]
           ],
           "sequential": [
            [
             0,
             "#0d0887"
            ],
            [
             0.1111111111111111,
             "#46039f"
            ],
            [
             0.2222222222222222,
             "#7201a8"
            ],
            [
             0.3333333333333333,
             "#9c179e"
            ],
            [
             0.4444444444444444,
             "#bd3786"
            ],
            [
             0.5555555555555556,
             "#d8576b"
            ],
            [
             0.6666666666666666,
             "#ed7953"
            ],
            [
             0.7777777777777778,
             "#fb9f3a"
            ],
            [
             0.8888888888888888,
             "#fdca26"
            ],
            [
             1,
             "#f0f921"
            ]
           ],
           "sequentialminus": [
            [
             0,
             "#0d0887"
            ],
            [
             0.1111111111111111,
             "#46039f"
            ],
            [
             0.2222222222222222,
             "#7201a8"
            ],
            [
             0.3333333333333333,
             "#9c179e"
            ],
            [
             0.4444444444444444,
             "#bd3786"
            ],
            [
             0.5555555555555556,
             "#d8576b"
            ],
            [
             0.6666666666666666,
             "#ed7953"
            ],
            [
             0.7777777777777778,
             "#fb9f3a"
            ],
            [
             0.8888888888888888,
             "#fdca26"
            ],
            [
             1,
             "#f0f921"
            ]
           ]
          },
          "colorway": [
           "#636efa",
           "#EF553B",
           "#00cc96",
           "#ab63fa",
           "#FFA15A",
           "#19d3f3",
           "#FF6692",
           "#B6E880",
           "#FF97FF",
           "#FECB52"
          ],
          "font": {
           "color": "#2a3f5f"
          },
          "geo": {
           "bgcolor": "white",
           "lakecolor": "white",
           "landcolor": "#E5ECF6",
           "showlakes": true,
           "showland": true,
           "subunitcolor": "white"
          },
          "hoverlabel": {
           "align": "left"
          },
          "hovermode": "closest",
          "mapbox": {
           "style": "light"
          },
          "paper_bgcolor": "white",
          "plot_bgcolor": "#E5ECF6",
          "polar": {
           "angularaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "bgcolor": "#E5ECF6",
           "radialaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           }
          },
          "scene": {
           "xaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           },
           "yaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           },
           "zaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           }
          },
          "shapedefaults": {
           "line": {
            "color": "#2a3f5f"
           }
          },
          "ternary": {
           "aaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "baxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "bgcolor": "#E5ECF6",
           "caxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           }
          },
          "title": {
           "x": 0.05
          },
          "xaxis": {
           "automargin": true,
           "gridcolor": "white",
           "linecolor": "white",
           "ticks": "",
           "title": {
            "standoff": 15
           },
           "zerolinecolor": "white",
           "zerolinewidth": 2
          },
          "yaxis": {
           "automargin": true,
           "gridcolor": "white",
           "linecolor": "white",
           "ticks": "",
           "title": {
            "standoff": 15
           },
           "zerolinecolor": "white",
           "zerolinewidth": 2
          }
         }
        },
        "xaxis": {
         "anchor": "y",
         "domain": [
          0,
          1
         ],
         "title": {
          "text": "选择购买季节"
         }
        },
        "yaxis": {
         "anchor": "x",
         "domain": [
          0,
          1
         ],
         "title": {
          "text": "count"
         }
        }
       }
      }
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "fig = px.bar(df,x=\"选择购买季节\")\n",
    "fig.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [],
   "source": [
    "result = df['选择购买季节'].value_counts(sort=False,\n",
    "                                     normalize=True).to_frame() * 100"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/vnd.plotly.v1+json": {
       "config": {
        "plotlyServerURL": "https://plot.ly"
       },
       "data": [
        {
         "alignmentgroup": "True",
         "hovertemplate": "index=%{x}<br>选择购买季节=%{text}<extra></extra>",
         "legendgroup": "",
         "marker": {
          "color": "#636efa",
          "pattern": {
           "shape": ""
          }
         },
         "name": "",
         "offsetgroup": "",
         "orientation": "v",
         "showlegend": false,
         "text": [
          40.52287581699346,
          30.065359477124183,
          0.6535947712418301,
          4.57516339869281,
          7.8431372549019605,
          0.6535947712418301,
          1.9607843137254901,
          3.2679738562091507,
          0.6535947712418301,
          3.2679738562091507,
          1.3071895424836601,
          2.6143790849673203,
          0.6535947712418301,
          0.6535947712418301,
          0.6535947712418301,
          0.6535947712418301
         ],
         "textposition": "outside",
         "texttemplate": "%{text:.1f}%",
         "type": "bar",
         "x": [
          "【E.不论季节】",
          "【B.夏季】",
          "【A.春季】,【B.夏季】,【C.秋季】,【D.冬季】",
          "【A.春季】,【B.夏季】,【C.秋季】,【D.冬季】,【E.不论季节】",
          "【B.夏季】,【C.秋季】",
          "【A.春季】,【E.不论季节】",
          "【A.春季】,【B.夏季】,【C.秋季】",
          "【D.冬季】",
          "【C.秋季】,【D.冬季】",
          "【B.夏季】,【E.不论季节】",
          "【A.春季】,【B.夏季】",
          "【A.春季】",
          "【B.夏季】,【C.秋季】,【D.冬季】",
          "【D.冬季】,【E.不论季节】",
          "【B.夏季】,【D.冬季】",
          "【C.秋季】"
         ],
         "xaxis": "x",
         "y": [
          40.52287581699346,
          30.065359477124183,
          0.6535947712418301,
          4.57516339869281,
          7.8431372549019605,
          0.6535947712418301,
          1.9607843137254901,
          3.2679738562091507,
          0.6535947712418301,
          3.2679738562091507,
          1.3071895424836601,
          2.6143790849673203,
          0.6535947712418301,
          0.6535947712418301,
          0.6535947712418301,
          0.6535947712418301
         ],
         "yaxis": "y"
        }
       ],
       "layout": {
        "barmode": "relative",
        "height": 500,
        "legend": {
         "tracegroupgap": 0
        },
        "margin": {
         "t": 60
        },
        "template": {
         "data": {
          "bar": [
           {
            "error_x": {
             "color": "#2a3f5f"
            },
            "error_y": {
             "color": "#2a3f5f"
            },
            "marker": {
             "line": {
              "color": "white",
              "width": 0.5
             },
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "bar"
           }
          ],
          "barpolar": [
           {
            "marker": {
             "line": {
              "color": "white",
              "width": 0.5
             },
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "barpolar"
           }
          ],
          "carpet": [
           {
            "aaxis": {
             "endlinecolor": "#2a3f5f",
             "gridcolor": "#C8D4E3",
             "linecolor": "#C8D4E3",
             "minorgridcolor": "#C8D4E3",
             "startlinecolor": "#2a3f5f"
            },
            "baxis": {
             "endlinecolor": "#2a3f5f",
             "gridcolor": "#C8D4E3",
             "linecolor": "#C8D4E3",
             "minorgridcolor": "#C8D4E3",
             "startlinecolor": "#2a3f5f"
            },
            "type": "carpet"
           }
          ],
          "choropleth": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "choropleth"
           }
          ],
          "contour": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "contour"
           }
          ],
          "contourcarpet": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "contourcarpet"
           }
          ],
          "heatmap": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "heatmap"
           }
          ],
          "heatmapgl": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "heatmapgl"
           }
          ],
          "histogram": [
           {
            "marker": {
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "histogram"
           }
          ],
          "histogram2d": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "histogram2d"
           }
          ],
          "histogram2dcontour": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "histogram2dcontour"
           }
          ],
          "mesh3d": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "mesh3d"
           }
          ],
          "parcoords": [
           {
            "line": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "parcoords"
           }
          ],
          "pie": [
           {
            "automargin": true,
            "type": "pie"
           }
          ],
          "scatter": [
           {
            "fillpattern": {
             "fillmode": "overlay",
             "size": 10,
             "solidity": 0.2
            },
            "type": "scatter"
           }
          ],
          "scatter3d": [
           {
            "line": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatter3d"
           }
          ],
          "scattercarpet": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattercarpet"
           }
          ],
          "scattergeo": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattergeo"
           }
          ],
          "scattergl": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattergl"
           }
          ],
          "scattermapbox": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattermapbox"
           }
          ],
          "scatterpolar": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterpolar"
           }
          ],
          "scatterpolargl": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterpolargl"
           }
          ],
          "scatterternary": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterternary"
           }
          ],
          "surface": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "surface"
           }
          ],
          "table": [
           {
            "cells": {
             "fill": {
              "color": "#EBF0F8"
             },
             "line": {
              "color": "white"
             }
            },
            "header": {
             "fill": {
              "color": "#C8D4E3"
             },
             "line": {
              "color": "white"
             }
            },
            "type": "table"
           }
          ]
         },
         "layout": {
          "annotationdefaults": {
           "arrowcolor": "#2a3f5f",
           "arrowhead": 0,
           "arrowwidth": 1
          },
          "autotypenumbers": "strict",
          "coloraxis": {
           "colorbar": {
            "outlinewidth": 0,
            "ticks": ""
           }
          },
          "colorscale": {
           "diverging": [
            [
             0,
             "#8e0152"
            ],
            [
             0.1,
             "#c51b7d"
            ],
            [
             0.2,
             "#de77ae"
            ],
            [
             0.3,
             "#f1b6da"
            ],
            [
             0.4,
             "#fde0ef"
            ],
            [
             0.5,
             "#f7f7f7"
            ],
            [
             0.6,
             "#e6f5d0"
            ],
            [
             0.7,
             "#b8e186"
            ],
            [
             0.8,
             "#7fbc41"
            ],
            [
             0.9,
             "#4d9221"
            ],
            [
             1,
             "#276419"
            ]
           ],
           "sequential": [
            [
             0,
             "#0d0887"
            ],
            [
             0.1111111111111111,
             "#46039f"
            ],
            [
             0.2222222222222222,
             "#7201a8"
            ],
            [
             0.3333333333333333,
             "#9c179e"
            ],
            [
             0.4444444444444444,
             "#bd3786"
            ],
            [
             0.5555555555555556,
             "#d8576b"
            ],
            [
             0.6666666666666666,
             "#ed7953"
            ],
            [
             0.7777777777777778,
             "#fb9f3a"
            ],
            [
             0.8888888888888888,
             "#fdca26"
            ],
            [
             1,
             "#f0f921"
            ]
           ],
           "sequentialminus": [
            [
             0,
             "#0d0887"
            ],
            [
             0.1111111111111111,
             "#46039f"
            ],
            [
             0.2222222222222222,
             "#7201a8"
            ],
            [
             0.3333333333333333,
             "#9c179e"
            ],
            [
             0.4444444444444444,
             "#bd3786"
            ],
            [
             0.5555555555555556,
             "#d8576b"
            ],
            [
             0.6666666666666666,
             "#ed7953"
            ],
            [
             0.7777777777777778,
             "#fb9f3a"
            ],
            [
             0.8888888888888888,
             "#fdca26"
            ],
            [
             1,
             "#f0f921"
            ]
           ]
          },
          "colorway": [
           "#636efa",
           "#EF553B",
           "#00cc96",
           "#ab63fa",
           "#FFA15A",
           "#19d3f3",
           "#FF6692",
           "#B6E880",
           "#FF97FF",
           "#FECB52"
          ],
          "font": {
           "color": "#2a3f5f"
          },
          "geo": {
           "bgcolor": "white",
           "lakecolor": "white",
           "landcolor": "white",
           "showlakes": true,
           "showland": true,
           "subunitcolor": "#C8D4E3"
          },
          "hoverlabel": {
           "align": "left"
          },
          "hovermode": "closest",
          "mapbox": {
           "style": "light"
          },
          "paper_bgcolor": "white",
          "plot_bgcolor": "white",
          "polar": {
           "angularaxis": {
            "gridcolor": "#EBF0F8",
            "linecolor": "#EBF0F8",
            "ticks": ""
           },
           "bgcolor": "white",
           "radialaxis": {
            "gridcolor": "#EBF0F8",
            "linecolor": "#EBF0F8",
            "ticks": ""
           }
          },
          "scene": {
           "xaxis": {
            "backgroundcolor": "white",
            "gridcolor": "#DFE8F3",
            "gridwidth": 2,
            "linecolor": "#EBF0F8",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "#EBF0F8"
           },
           "yaxis": {
            "backgroundcolor": "white",
            "gridcolor": "#DFE8F3",
            "gridwidth": 2,
            "linecolor": "#EBF0F8",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "#EBF0F8"
           },
           "zaxis": {
            "backgroundcolor": "white",
            "gridcolor": "#DFE8F3",
            "gridwidth": 2,
            "linecolor": "#EBF0F8",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "#EBF0F8"
           }
          },
          "shapedefaults": {
           "line": {
            "color": "#2a3f5f"
           }
          },
          "ternary": {
           "aaxis": {
            "gridcolor": "#DFE8F3",
            "linecolor": "#A2B1C6",
            "ticks": ""
           },
           "baxis": {
            "gridcolor": "#DFE8F3",
            "linecolor": "#A2B1C6",
            "ticks": ""
           },
           "bgcolor": "white",
           "caxis": {
            "gridcolor": "#DFE8F3",
            "linecolor": "#A2B1C6",
            "ticks": ""
           }
          },
          "title": {
           "x": 0.05
          },
          "xaxis": {
           "automargin": true,
           "gridcolor": "#EBF0F8",
           "linecolor": "#EBF0F8",
           "ticks": "",
           "title": {
            "standoff": 15
           },
           "zerolinecolor": "#EBF0F8",
           "zerolinewidth": 2
          },
          "yaxis": {
           "automargin": true,
           "gridcolor": "#EBF0F8",
           "linecolor": "#EBF0F8",
           "ticks": "",
           "title": {
            "standoff": 15
           },
           "zerolinecolor": "#EBF0F8",
           "zerolinewidth": 2
          }
         }
        },
        "width": 700,
        "xaxis": {
         "anchor": "y",
         "domain": [
          0,
          1
         ],
         "title": {
          "text": "选择购买季节"
         }
        },
        "yaxis": {
         "anchor": "x",
         "domain": [
          0,
          1
         ],
         "range": [
          0,
          60
         ],
         "title": {
          "text": "比例(%)"
         }
        }
       }
      }
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "fig = px.bar(\n",
    "    result,\n",
    "    x=result.index,\n",
    "    y='选择购买季节',\n",
    "    text='选择购买季节',\n",
    "    text_auto=True,\n",
    "    range_y=[0, 60],\n",
    "    width=700,\n",
    "    height=500,\n",
    "    template='plotly_white'\n",
    ")\n",
    "fig.update_traces(\n",
    "    texttemplate='%{text:.1f}%',\n",
    "    textposition='outside',\n",
    ")\n",
    "fig.update_layout(\n",
    "    xaxis_title=\"选择购买季节\",\n",
    "    yaxis_title=\"比例(%)\",\n",
    ")\n",
    "fig.write_image(\"fig1.svg\")\n",
    "fig.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {},
   "outputs": [],
   "source": [
    "temp = df['选择购买季节'].value_counts(sort=False,\n",
    "                                     ).to_frame()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {},
   "outputs": [],
   "source": [
    "d = pd.DataFrame(data=np.zeros([temp.shape[0],4]),columns=['选择购买季节','性别','数值','比例'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/vnd.plotly.v1+json": {
       "config": {
        "plotlyServerURL": "https://plot.ly"
       },
       "data": [
        {
         "alignmentgroup": "True",
         "hovertemplate": "性别=【B.女】<br>选择购买季节=%{x}<br>count=%{y}<extra></extra>",
         "legendgroup": "【B.女】",
         "marker": {
          "color": "#636efa",
          "pattern": {
           "shape": ""
          }
         },
         "name": "【B.女】",
         "offsetgroup": "【B.女】",
         "orientation": "v",
         "showlegend": true,
         "textposition": "auto",
         "type": "bar",
         "x": [
          "【E.不论季节】",
          "【B.夏季】",
          "【E.不论季节】",
          "【A.春季】,【B.夏季】,【C.秋季】,【D.冬季】",
          "【A.春季】,【B.夏季】,【C.秋季】,【D.冬季】,【E.不论季节】",
          "【B.夏季】,【C.秋季】",
          "【B.夏季】,【C.秋季】",
          "【B.夏季】",
          "【B.夏季】",
          "【E.不论季节】",
          "【A.春季】,【B.夏季】,【C.秋季】",
          "【B.夏季】,【C.秋季】",
          "【D.冬季】",
          "【E.不论季节】",
          "【B.夏季】",
          "【A.春季】,【B.夏季】,【C.秋季】,【D.冬季】,【E.不论季节】",
          "【B.夏季】,【E.不论季节】",
          "【E.不论季节】",
          "【E.不论季节】",
          "【A.春季】,【B.夏季】,【C.秋季】,【D.冬季】,【E.不论季节】",
          "【B.夏季】",
          "【B.夏季】,【C.秋季】",
          "【A.春季】,【B.夏季】,【C.秋季】",
          "【B.夏季】",
          "【B.夏季】,【C.秋季】",
          "【E.不论季节】",
          "【E.不论季节】",
          "【B.夏季】",
          "【B.夏季】,【C.秋季】",
          "【E.不论季节】",
          "【B.夏季】",
          "【B.夏季】",
          "【E.不论季节】",
          "【E.不论季节】",
          "【E.不论季节】",
          "【B.夏季】",
          "【E.不论季节】",
          "【E.不论季节】",
          "【B.夏季】",
          "【B.夏季】",
          "【B.夏季】",
          "【B.夏季】",
          "【B.夏季】",
          "【B.夏季】,【E.不论季节】",
          "【B.夏季】",
          "【E.不论季节】",
          "【E.不论季节】",
          "【B.夏季】",
          "【B.夏季】",
          "【B.夏季】",
          "【A.春季】",
          "【B.夏季】",
          "【B.夏季】",
          "【B.夏季】",
          "【E.不论季节】",
          "【E.不论季节】",
          "【A.春季】",
          "【E.不论季节】",
          "【B.夏季】",
          "【B.夏季】,【C.秋季】",
          "【E.不论季节】",
          "【A.春季】",
          "【E.不论季节】",
          "【B.夏季】",
          "【E.不论季节】",
          "【E.不论季节】",
          "【B.夏季】",
          "【B.夏季】,【C.秋季】",
          "【E.不论季节】",
          "【E.不论季节】",
          "【A.春季】,【B.夏季】,【C.秋季】",
          "【E.不论季节】",
          "【E.不论季节】",
          "【B.夏季】,【C.秋季】",
          "【B.夏季】,【C.秋季】,【D.冬季】",
          "【A.春季】,【B.夏季】,【C.秋季】,【D.冬季】,【E.不论季节】",
          "【B.夏季】",
          "【B.夏季】",
          "【E.不论季节】",
          "【B.夏季】",
          "【D.冬季】,【E.不论季节】",
          "【A.春季】,【B.夏季】,【C.秋季】,【D.冬季】,【E.不论季节】",
          "【D.冬季】",
          "【B.夏季】",
          "【E.不论季节】",
          "【E.不论季节】",
          "【B.夏季】",
          "【E.不论季节】",
          "【E.不论季节】",
          "【E.不论季节】",
          "【E.不论季节】",
          "【E.不论季节】",
          "【B.夏季】",
          "【B.夏季】",
          "【B.夏季】",
          "【A.春季】",
          "【E.不论季节】",
          "【E.不论季节】",
          "【D.冬季】",
          "【B.夏季】",
          "【B.夏季】,【D.冬季】",
          "【E.不论季节】",
          "【E.不论季节】",
          "【E.不论季节】",
          "【B.夏季】",
          "【E.不论季节】",
          "【B.夏季】",
          "【E.不论季节】",
          "【B.夏季】",
          "【E.不论季节】",
          "【C.秋季】",
          "【A.春季】,【B.夏季】"
         ],
         "xaxis": "x",
         "y": [
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1
         ],
         "yaxis": "y"
        },
        {
         "alignmentgroup": "True",
         "hovertemplate": "性别=【A.男】<br>选择购买季节=%{x}<br>count=%{y}<extra></extra>",
         "legendgroup": "【A.男】",
         "marker": {
          "color": "#EF553B",
          "pattern": {
           "shape": ""
          }
         },
         "name": "【A.男】",
         "offsetgroup": "【A.男】",
         "orientation": "v",
         "showlegend": true,
         "textposition": "auto",
         "type": "bar",
         "x": [
          "【E.不论季节】",
          "【B.夏季】",
          "【B.夏季】",
          "【A.春季】,【E.不论季节】",
          "【C.秋季】,【D.冬季】",
          "【E.不论季节】",
          "【E.不论季节】",
          "【D.冬季】",
          "【A.春季】,【B.夏季】",
          "【A.春季】,【B.夏季】,【C.秋季】,【D.冬季】,【E.不论季节】",
          "【A.春季】,【B.夏季】,【C.秋季】,【D.冬季】,【E.不论季节】",
          "【B.夏季】",
          "【E.不论季节】",
          "【E.不论季节】",
          "【E.不论季节】",
          "【E.不论季节】",
          "【B.夏季】",
          "【E.不论季节】",
          "【B.夏季】",
          "【E.不论季节】",
          "【B.夏季】",
          "【E.不论季节】",
          "【B.夏季】",
          "【D.冬季】",
          "【B.夏季】,【C.秋季】",
          "【E.不论季节】",
          "【E.不论季节】",
          "【B.夏季】,【E.不论季节】",
          "【E.不论季节】",
          "【B.夏季】",
          "【E.不论季节】",
          "【B.夏季】",
          "【E.不论季节】",
          "【B.夏季】,【C.秋季】",
          "【E.不论季节】",
          "【E.不论季节】",
          "【B.夏季】,【E.不论季节】",
          "【E.不论季节】",
          "【B.夏季】,【E.不论季节】",
          "【B.夏季】,【C.秋季】",
          "【E.不论季节】"
         ],
         "xaxis": "x",
         "y": [
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1,
          1
         ],
         "yaxis": "y"
        }
       ],
       "layout": {
        "barmode": "group",
        "legend": {
         "title": {
          "text": "性别"
         },
         "tracegroupgap": 0
        },
        "margin": {
         "t": 60
        },
        "template": {
         "data": {
          "bar": [
           {
            "error_x": {
             "color": "#2a3f5f"
            },
            "error_y": {
             "color": "#2a3f5f"
            },
            "marker": {
             "line": {
              "color": "#E5ECF6",
              "width": 0.5
             },
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "bar"
           }
          ],
          "barpolar": [
           {
            "marker": {
             "line": {
              "color": "#E5ECF6",
              "width": 0.5
             },
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "barpolar"
           }
          ],
          "carpet": [
           {
            "aaxis": {
             "endlinecolor": "#2a3f5f",
             "gridcolor": "white",
             "linecolor": "white",
             "minorgridcolor": "white",
             "startlinecolor": "#2a3f5f"
            },
            "baxis": {
             "endlinecolor": "#2a3f5f",
             "gridcolor": "white",
             "linecolor": "white",
             "minorgridcolor": "white",
             "startlinecolor": "#2a3f5f"
            },
            "type": "carpet"
           }
          ],
          "choropleth": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "choropleth"
           }
          ],
          "contour": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "contour"
           }
          ],
          "contourcarpet": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "contourcarpet"
           }
          ],
          "heatmap": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "heatmap"
           }
          ],
          "heatmapgl": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "heatmapgl"
           }
          ],
          "histogram": [
           {
            "marker": {
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "histogram"
           }
          ],
          "histogram2d": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "histogram2d"
           }
          ],
          "histogram2dcontour": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "histogram2dcontour"
           }
          ],
          "mesh3d": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "mesh3d"
           }
          ],
          "parcoords": [
           {
            "line": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "parcoords"
           }
          ],
          "pie": [
           {
            "automargin": true,
            "type": "pie"
           }
          ],
          "scatter": [
           {
            "fillpattern": {
             "fillmode": "overlay",
             "size": 10,
             "solidity": 0.2
            },
            "type": "scatter"
           }
          ],
          "scatter3d": [
           {
            "line": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatter3d"
           }
          ],
          "scattercarpet": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattercarpet"
           }
          ],
          "scattergeo": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattergeo"
           }
          ],
          "scattergl": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattergl"
           }
          ],
          "scattermapbox": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattermapbox"
           }
          ],
          "scatterpolar": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterpolar"
           }
          ],
          "scatterpolargl": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterpolargl"
           }
          ],
          "scatterternary": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterternary"
           }
          ],
          "surface": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "surface"
           }
          ],
          "table": [
           {
            "cells": {
             "fill": {
              "color": "#EBF0F8"
             },
             "line": {
              "color": "white"
             }
            },
            "header": {
             "fill": {
              "color": "#C8D4E3"
             },
             "line": {
              "color": "white"
             }
            },
            "type": "table"
           }
          ]
         },
         "layout": {
          "annotationdefaults": {
           "arrowcolor": "#2a3f5f",
           "arrowhead": 0,
           "arrowwidth": 1
          },
          "autotypenumbers": "strict",
          "coloraxis": {
           "colorbar": {
            "outlinewidth": 0,
            "ticks": ""
           }
          },
          "colorscale": {
           "diverging": [
            [
             0,
             "#8e0152"
            ],
            [
             0.1,
             "#c51b7d"
            ],
            [
             0.2,
             "#de77ae"
            ],
            [
             0.3,
             "#f1b6da"
            ],
            [
             0.4,
             "#fde0ef"
            ],
            [
             0.5,
             "#f7f7f7"
            ],
            [
             0.6,
             "#e6f5d0"
            ],
            [
             0.7,
             "#b8e186"
            ],
            [
             0.8,
             "#7fbc41"
            ],
            [
             0.9,
             "#4d9221"
            ],
            [
             1,
             "#276419"
            ]
           ],
           "sequential": [
            [
             0,
             "#0d0887"
            ],
            [
             0.1111111111111111,
             "#46039f"
            ],
            [
             0.2222222222222222,
             "#7201a8"
            ],
            [
             0.3333333333333333,
             "#9c179e"
            ],
            [
             0.4444444444444444,
             "#bd3786"
            ],
            [
             0.5555555555555556,
             "#d8576b"
            ],
            [
             0.6666666666666666,
             "#ed7953"
            ],
            [
             0.7777777777777778,
             "#fb9f3a"
            ],
            [
             0.8888888888888888,
             "#fdca26"
            ],
            [
             1,
             "#f0f921"
            ]
           ],
           "sequentialminus": [
            [
             0,
             "#0d0887"
            ],
            [
             0.1111111111111111,
             "#46039f"
            ],
            [
             0.2222222222222222,
             "#7201a8"
            ],
            [
             0.3333333333333333,
             "#9c179e"
            ],
            [
             0.4444444444444444,
             "#bd3786"
            ],
            [
             0.5555555555555556,
             "#d8576b"
            ],
            [
             0.6666666666666666,
             "#ed7953"
            ],
            [
             0.7777777777777778,
             "#fb9f3a"
            ],
            [
             0.8888888888888888,
             "#fdca26"
            ],
            [
             1,
             "#f0f921"
            ]
           ]
          },
          "colorway": [
           "#636efa",
           "#EF553B",
           "#00cc96",
           "#ab63fa",
           "#FFA15A",
           "#19d3f3",
           "#FF6692",
           "#B6E880",
           "#FF97FF",
           "#FECB52"
          ],
          "font": {
           "color": "#2a3f5f"
          },
          "geo": {
           "bgcolor": "white",
           "lakecolor": "white",
           "landcolor": "#E5ECF6",
           "showlakes": true,
           "showland": true,
           "subunitcolor": "white"
          },
          "hoverlabel": {
           "align": "left"
          },
          "hovermode": "closest",
          "mapbox": {
           "style": "light"
          },
          "paper_bgcolor": "white",
          "plot_bgcolor": "#E5ECF6",
          "polar": {
           "angularaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "bgcolor": "#E5ECF6",
           "radialaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           }
          },
          "scene": {
           "xaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           },
           "yaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           },
           "zaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           }
          },
          "shapedefaults": {
           "line": {
            "color": "#2a3f5f"
           }
          },
          "ternary": {
           "aaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "baxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "bgcolor": "#E5ECF6",
           "caxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           }
          },
          "title": {
           "x": 0.05
          },
          "xaxis": {
           "automargin": true,
           "gridcolor": "white",
           "linecolor": "white",
           "ticks": "",
           "title": {
            "standoff": 15
           },
           "zerolinecolor": "white",
           "zerolinewidth": 2
          },
          "yaxis": {
           "automargin": true,
           "gridcolor": "white",
           "linecolor": "white",
           "ticks": "",
           "title": {
            "standoff": 15
           },
           "zerolinecolor": "white",
           "zerolinewidth": 2
          }
         }
        },
        "xaxis": {
         "anchor": "y",
         "domain": [
          0,
          1
         ],
         "title": {
          "text": "选择购买季节"
         }
        },
        "yaxis": {
         "anchor": "x",
         "domain": [
          0,
          1
         ],
         "title": {
          "text": "count"
         }
        }
       }
      }
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "fig = px.bar(df,x='选择购买季节',color='性别',barmode='group')\n",
    "fig.show()"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 样本基本现状\n",
    "## 多选题分析"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "【A.明显提高茅台与蒙牛的知名度】,【B.拓展品牌的消费群体】,【C.增加产品的多样性】,【D.带给品牌更多的话题和关注度】,【E.风险大，冰淇淋的接受直接影响了品牌口碑容易流失原本客户】\n",
      "【A.明显提高茅台与蒙牛的知名度】,【C.增加产品的多样性】,【D.带给品牌更多的话题和关注度】,【E.风险大，冰淇淋的接受直接影响了品牌口碑容易流失原本客户】\n",
      "【C.增加产品的多样性】,【E.风险大，冰淇淋的接受直接影响了品牌口碑容易流失原本客户】\n",
      "【B.拓展品牌的消费群体】,【C.增加产品的多样性】,【D.带给品牌更多的话题和关注度】\n",
      "【A.明显提高茅台与蒙牛的知名度】,【B.拓展品牌的消费群体】,【C.增加产品的多样性】,【D.带给品牌更多的话题和关注度】\n",
      "【C.增加产品的多样性】\n",
      "【D.带给品牌更多的话题和关注度】,【E.风险大，冰淇淋的接受直接影响了品牌口碑容易流失原本客户】\n",
      "【A.明显提高茅台与蒙牛的知名度】,【B.拓展品牌的消费群体】,【C.增加产品的多样性】\n",
      "【A.明显提高茅台与蒙牛的知名度】,【B.拓展品牌的消费群体】,【C.增加产品的多样性】,【D.带给品牌更多的话题和关注度】\n",
      "【A.明显提高茅台与蒙牛的知名度】\n",
      "【A.明显提高茅台与蒙牛的知名度】,【B.拓展品牌的消费群体】,【C.增加产品的多样性】,【D.带给品牌更多的话题和关注度】\n",
      "【A.明显提高茅台与蒙牛的知名度】,【C.增加产品的多样性】\n",
      "【A.明显提高茅台与蒙牛的知名度】,【B.拓展品牌的消费群体】,【C.增加产品的多样性】,【D.带给品牌更多的话题和关注度】\n",
      "【A.明显提高茅台与蒙牛的知名度】,【B.拓展品牌的消费群体】,【D.带给品牌更多的话题和关注度】,【E.风险大，冰淇淋的接受直接影响了品牌口碑容易流失原本客户】\n",
      "【B.拓展品牌的消费群体】,【C.增加产品的多样性】,【D.带给品牌更多的话题和关注度】\n",
      "【A.明显提高茅台与蒙牛的知名度】,【B.拓展品牌的消费群体】,【C.增加产品的多样性】,【D.带给品牌更多的话题和关注度】,【E.风险大，冰淇淋的接受直接影响了品牌口碑容易流失原本客户】\n",
      "【A.明显提高茅台与蒙牛的知名度】,【D.带给品牌更多的话题和关注度】,【E.风险大，冰淇淋的接受直接影响了品牌口碑容易流失原本客户】\n",
      "【B.拓展品牌的消费群体】,【D.带给品牌更多的话题和关注度】\n",
      "【B.拓展品牌的消费群体】,【C.增加产品的多样性】\n",
      "【A.明显提高茅台与蒙牛的知名度】,【C.增加产品的多样性】,【D.带给品牌更多的话题和关注度】\n",
      "【A.明显提高茅台与蒙牛的知名度】,【B.拓展品牌的消费群体】,【C.增加产品的多样性】,【D.带给品牌更多的话题和关注度】\n",
      "【A.明显提高茅台与蒙牛的知名度】,【C.增加产品的多样性】,【E.风险大，冰淇淋的接受直接影响了品牌口碑容易流失原本客户】\n",
      "【B.拓展品牌的消费群体】,【C.增加产品的多样性】,【D.带给品牌更多的话题和关注度】\n",
      "【C.增加产品的多样性】\n",
      "【C.增加产品的多样性】,【D.带给品牌更多的话题和关注度】\n",
      "【C.增加产品的多样性】,【D.带给品牌更多的话题和关注度】\n",
      "【B.拓展品牌的消费群体】,【D.带给品牌更多的话题和关注度】\n",
      "【C.增加产品的多样性】,【D.带给品牌更多的话题和关注度】,【E.风险大，冰淇淋的接受直接影响了品牌口碑容易流失原本客户】\n",
      "【A.明显提高茅台与蒙牛的知名度】\n",
      "【C.增加产品的多样性】,【D.带给品牌更多的话题和关注度】\n",
      "【A.明显提高茅台与蒙牛的知名度】\n",
      "【A.明显提高茅台与蒙牛的知名度】,【B.拓展品牌的消费群体】,【C.增加产品的多样性】,【D.带给品牌更多的话题和关注度】\n",
      "【C.增加产品的多样性】\n",
      "【C.增加产品的多样性】\n",
      "【B.拓展品牌的消费群体】,【C.增加产品的多样性】,【D.带给品牌更多的话题和关注度】\n",
      "【C.增加产品的多样性】\n",
      "【A.明显提高茅台与蒙牛的知名度】,【B.拓展品牌的消费群体】,【C.增加产品的多样性】,【D.带给品牌更多的话题和关注度】\n",
      "【E.风险大，冰淇淋的接受直接影响了品牌口碑容易流失原本客户】\n",
      "【A.明显提高茅台与蒙牛的知名度】\n",
      "【A.明显提高茅台与蒙牛的知名度】,【B.拓展品牌的消费群体】,【C.增加产品的多样性】,【D.带给品牌更多的话题和关注度】,【E.风险大，冰淇淋的接受直接影响了品牌口碑容易流失原本客户】\n",
      "【A.明显提高茅台与蒙牛的知名度】,【B.拓展品牌的消费群体】,【C.增加产品的多样性】,【D.带给品牌更多的话题和关注度】\n",
      "【A.明显提高茅台与蒙牛的知名度】\n",
      "【A.明显提高茅台与蒙牛的知名度】,【B.拓展品牌的消费群体】,【C.增加产品的多样性】,【D.带给品牌更多的话题和关注度】,【E.风险大，冰淇淋的接受直接影响了品牌口碑容易流失原本客户】\n",
      "【D.带给品牌更多的话题和关注度】\n",
      "【A.明显提高茅台与蒙牛的知名度】\n",
      "【A.明显提高茅台与蒙牛的知名度】,【B.拓展品牌的消费群体】,【C.增加产品的多样性】\n",
      "【A.明显提高茅台与蒙牛的知名度】,【B.拓展品牌的消费群体】,【C.增加产品的多样性】,【D.带给品牌更多的话题和关注度】,【E.风险大，冰淇淋的接受直接影响了品牌口碑容易流失原本客户】\n",
      "【D.带给品牌更多的话题和关注度】,【E.风险大，冰淇淋的接受直接影响了品牌口碑容易流失原本客户】\n",
      "【C.增加产品的多样性】,【D.带给品牌更多的话题和关注度】\n",
      "【A.明显提高茅台与蒙牛的知名度】,【B.拓展品牌的消费群体】,【C.增加产品的多样性】,【D.带给品牌更多的话题和关注度】\n",
      "【A.明显提高茅台与蒙牛的知名度】,【D.带给品牌更多的话题和关注度】\n",
      "【A.明显提高茅台与蒙牛的知名度】,【B.拓展品牌的消费群体】,【C.增加产品的多样性】,【D.带给品牌更多的话题和关注度】\n",
      "【B.拓展品牌的消费群体】,【C.增加产品的多样性】,【D.带给品牌更多的话题和关注度】\n",
      "【A.明显提高茅台与蒙牛的知名度】,【B.拓展品牌的消费群体】\n",
      "【A.明显提高茅台与蒙牛的知名度】,【B.拓展品牌的消费群体】,【C.增加产品的多样性】\n",
      "【A.明显提高茅台与蒙牛的知名度】,【B.拓展品牌的消费群体】\n",
      "【A.明显提高茅台与蒙牛的知名度】,【D.带给品牌更多的话题和关注度】\n",
      "【B.拓展品牌的消费群体】,【E.风险大，冰淇淋的接受直接影响了品牌口碑容易流失原本客户】\n",
      "【A.明显提高茅台与蒙牛的知名度】\n",
      "【A.明显提高茅台与蒙牛的知名度】,【B.拓展品牌的消费群体】,【D.带给品牌更多的话题和关注度】\n",
      "【B.拓展品牌的消费群体】,【E.风险大，冰淇淋的接受直接影响了品牌口碑容易流失原本客户】\n",
      "【C.增加产品的多样性】\n",
      "【B.拓展品牌的消费群体】,【D.带给品牌更多的话题和关注度】\n",
      "【A.明显提高茅台与蒙牛的知名度】,【D.带给品牌更多的话题和关注度】\n",
      "【B.拓展品牌的消费群体】,【D.带给品牌更多的话题和关注度】\n",
      "【A.明显提高茅台与蒙牛的知名度】\n",
      "【C.增加产品的多样性】\n",
      "【A.明显提高茅台与蒙牛的知名度】,【C.增加产品的多样性】,【D.带给品牌更多的话题和关注度】\n",
      "【A.明显提高茅台与蒙牛的知名度】,【C.增加产品的多样性】,【D.带给品牌更多的话题和关注度】\n",
      "【A.明显提高茅台与蒙牛的知名度】,【B.拓展品牌的消费群体】,【C.增加产品的多样性】,【D.带给品牌更多的话题和关注度】\n",
      "【A.明显提高茅台与蒙牛的知名度】\n",
      "【A.明显提高茅台与蒙牛的知名度】,【C.增加产品的多样性】,【D.带给品牌更多的话题和关注度】\n",
      "【A.明显提高茅台与蒙牛的知名度】,【B.拓展品牌的消费群体】,【C.增加产品的多样性】,【D.带给品牌更多的话题和关注度】\n",
      "【A.明显提高茅台与蒙牛的知名度】,【B.拓展品牌的消费群体】\n",
      "【A.明显提高茅台与蒙牛的知名度】,【B.拓展品牌的消费群体】,【C.增加产品的多样性】,【D.带给品牌更多的话题和关注度】\n",
      "【A.明显提高茅台与蒙牛的知名度】,【B.拓展品牌的消费群体】,【C.增加产品的多样性】,【D.带给品牌更多的话题和关注度】,【E.风险大，冰淇淋的接受直接影响了品牌口碑容易流失原本客户】\n",
      "【C.增加产品的多样性】,【D.带给品牌更多的话题和关注度】\n",
      "【A.明显提高茅台与蒙牛的知名度】\n",
      "【A.明显提高茅台与蒙牛的知名度】,【B.拓展品牌的消费群体】,【C.增加产品的多样性】,【D.带给品牌更多的话题和关注度】\n",
      "【D.带给品牌更多的话题和关注度】\n",
      "【A.明显提高茅台与蒙牛的知名度】\n",
      "【A.明显提高茅台与蒙牛的知名度】,【B.拓展品牌的消费群体】,【C.增加产品的多样性】,【D.带给品牌更多的话题和关注度】,【E.风险大，冰淇淋的接受直接影响了品牌口碑容易流失原本客户】\n",
      "【C.增加产品的多样性】,【D.带给品牌更多的话题和关注度】\n",
      "【A.明显提高茅台与蒙牛的知名度】,【B.拓展品牌的消费群体】,【C.增加产品的多样性】,【D.带给品牌更多的话题和关注度】,【E.风险大，冰淇淋的接受直接影响了品牌口碑容易流失原本客户】\n",
      "【C.增加产品的多样性】,【D.带给品牌更多的话题和关注度】,【E.风险大，冰淇淋的接受直接影响了品牌口碑容易流失原本客户】\n",
      "【B.拓展品牌的消费群体】,【C.增加产品的多样性】\n",
      "【B.拓展品牌的消费群体】,【C.增加产品的多样性】,【D.带给品牌更多的话题和关注度】\n",
      "【A.明显提高茅台与蒙牛的知名度】,【B.拓展品牌的消费群体】,【C.增加产品的多样性】,【D.带给品牌更多的话题和关注度】,【E.风险大，冰淇淋的接受直接影响了品牌口碑容易流失原本客户】\n",
      "【A.明显提高茅台与蒙牛的知名度】,【B.拓展品牌的消费群体】,【C.增加产品的多样性】,【D.带给品牌更多的话题和关注度】\n",
      "【A.明显提高茅台与蒙牛的知名度】\n",
      "【B.拓展品牌的消费群体】\n",
      "【B.拓展品牌的消费群体】,【C.增加产品的多样性】,【D.带给品牌更多的话题和关注度】\n",
      "【A.明显提高茅台与蒙牛的知名度】,【B.拓展品牌的消费群体】,【C.增加产品的多样性】,【D.带给品牌更多的话题和关注度】\n",
      "【B.拓展品牌的消费群体】,【D.带给品牌更多的话题和关注度】,【E.风险大，冰淇淋的接受直接影响了品牌口碑容易流失原本客户】\n",
      "【C.增加产品的多样性】,【D.带给品牌更多的话题和关注度】\n",
      "【C.增加产品的多样性】\n",
      "【A.明显提高茅台与蒙牛的知名度】,【B.拓展品牌的消费群体】,【C.增加产品的多样性】,【D.带给品牌更多的话题和关注度】\n",
      "【A.明显提高茅台与蒙牛的知名度】,【B.拓展品牌的消费群体】,【C.增加产品的多样性】,【D.带给品牌更多的话题和关注度】,【E.风险大，冰淇淋的接受直接影响了品牌口碑容易流失原本客户】\n",
      "【A.明显提高茅台与蒙牛的知名度】,【D.带给品牌更多的话题和关注度】\n",
      "【D.带给品牌更多的话题和关注度】\n",
      "【A.明显提高茅台与蒙牛的知名度】,【B.拓展品牌的消费群体】,【C.增加产品的多样性】,【D.带给品牌更多的话题和关注度】\n",
      "【A.明显提高茅台与蒙牛的知名度】\n",
      "【A.明显提高茅台与蒙牛的知名度】,【C.增加产品的多样性】,【D.带给品牌更多的话题和关注度】\n",
      "【A.明显提高茅台与蒙牛的知名度】,【B.拓展品牌的消费群体】,【C.增加产品的多样性】,【E.风险大，冰淇淋的接受直接影响了品牌口碑容易流失原本客户】\n",
      "【A.明显提高茅台与蒙牛的知名度】,【B.拓展品牌的消费群体】\n",
      "【B.拓展品牌的消费群体】\n",
      "【A.明显提高茅台与蒙牛的知名度】,【B.拓展品牌的消费群体】,【C.增加产品的多样性】,【D.带给品牌更多的话题和关注度】\n",
      "【A.明显提高茅台与蒙牛的知名度】,【B.拓展品牌的消费群体】,【C.增加产品的多样性】,【D.带给品牌更多的话题和关注度】,【E.风险大，冰淇淋的接受直接影响了品牌口碑容易流失原本客户】\n",
      "【A.明显提高茅台与蒙牛的知名度】\n",
      "【A.明显提高茅台与蒙牛的知名度】\n",
      "【A.明显提高茅台与蒙牛的知名度】,【B.拓展品牌的消费群体】,【C.增加产品的多样性】,【D.带给品牌更多的话题和关注度】,【E.风险大，冰淇淋的接受直接影响了品牌口碑容易流失原本客户】\n",
      "【B.拓展品牌的消费群体】,【C.增加产品的多样性】,【D.带给品牌更多的话题和关注度】\n",
      "【B.拓展品牌的消费群体】,【D.带给品牌更多的话题和关注度】\n",
      "【A.明显提高茅台与蒙牛的知名度】,【B.拓展品牌的消费群体】,【C.增加产品的多样性】,【D.带给品牌更多的话题和关注度】,【E.风险大，冰淇淋的接受直接影响了品牌口碑容易流失原本客户】\n",
      "【A.明显提高茅台与蒙牛的知名度】,【B.拓展品牌的消费群体】,【C.增加产品的多样性】,【D.带给品牌更多的话题和关注度】\n",
      "【B.拓展品牌的消费群体】,【C.增加产品的多样性】,【D.带给品牌更多的话题和关注度】\n",
      "【A.明显提高茅台与蒙牛的知名度】,【B.拓展品牌的消费群体】,【C.增加产品的多样性】,【D.带给品牌更多的话题和关注度】\n",
      "【B.拓展品牌的消费群体】,【C.增加产品的多样性】,【D.带给品牌更多的话题和关注度】\n",
      "【C.增加产品的多样性】\n",
      "【B.拓展品牌的消费群体】,【C.增加产品的多样性】,【D.带给品牌更多的话题和关注度】,【E.风险大，冰淇淋的接受直接影响了品牌口碑容易流失原本客户】\n",
      "【A.明显提高茅台与蒙牛的知名度】,【B.拓展品牌的消费群体】,【C.增加产品的多样性】,【D.带给品牌更多的话题和关注度】\n",
      "【C.增加产品的多样性】\n",
      "【A.明显提高茅台与蒙牛的知名度】,【C.增加产品的多样性】,【D.带给品牌更多的话题和关注度】\n",
      "【C.增加产品的多样性】,【D.带给品牌更多的话题和关注度】\n",
      "【C.增加产品的多样性】,【D.带给品牌更多的话题和关注度】\n",
      "【E.风险大，冰淇淋的接受直接影响了品牌口碑容易流失原本客户】\n",
      "【D.带给品牌更多的话题和关注度】\n",
      "【C.增加产品的多样性】,【D.带给品牌更多的话题和关注度】\n",
      "【A.明显提高茅台与蒙牛的知名度】,【B.拓展品牌的消费群体】,【C.增加产品的多样性】,【D.带给品牌更多的话题和关注度】,【E.风险大，冰淇淋的接受直接影响了品牌口碑容易流失原本客户】\n",
      "【B.拓展品牌的消费群体】,【C.增加产品的多样性】\n",
      "【A.明显提高茅台与蒙牛的知名度】,【B.拓展品牌的消费群体】\n",
      "【C.增加产品的多样性】,【D.带给品牌更多的话题和关注度】\n",
      "【A.明显提高茅台与蒙牛的知名度】\n",
      "【E.风险大，冰淇淋的接受直接影响了品牌口碑容易流失原本客户】\n",
      "【A.明显提高茅台与蒙牛的知名度】,【B.拓展品牌的消费群体】\n",
      "【A.明显提高茅台与蒙牛的知名度】\n",
      "【A.明显提高茅台与蒙牛的知名度】,【B.拓展品牌的消费群体】,【C.增加产品的多样性】,【D.带给品牌更多的话题和关注度】,【E.风险大，冰淇淋的接受直接影响了品牌口碑容易流失原本客户】\n",
      "【E.风险大，冰淇淋的接受直接影响了品牌口碑容易流失原本客户】\n",
      "【C.增加产品的多样性】,【D.带给品牌更多的话题和关注度】\n",
      "【A.明显提高茅台与蒙牛的知名度】,【B.拓展品牌的消费群体】,【C.增加产品的多样性】,【D.带给品牌更多的话题和关注度】\n",
      "【A.明显提高茅台与蒙牛的知名度】,【B.拓展品牌的消费群体】,【C.增加产品的多样性】,【D.带给品牌更多的话题和关注度】\n",
      "【A.明显提高茅台与蒙牛的知名度】,【B.拓展品牌的消费群体】,【C.增加产品的多样性】,【D.带给品牌更多的话题和关注度】,【E.风险大，冰淇淋的接受直接影响了品牌口碑容易流失原本客户】\n",
      "【B.拓展品牌的消费群体】,【C.增加产品的多样性】,【D.带给品牌更多的话题和关注度】\n",
      "【C.增加产品的多样性】,【D.带给品牌更多的话题和关注度】\n",
      "【C.增加产品的多样性】,【D.带给品牌更多的话题和关注度】\n",
      "【D.带给品牌更多的话题和关注度】\n",
      "【A.明显提高茅台与蒙牛的知名度】,【B.拓展品牌的消费群体】,【C.增加产品的多样性】,【D.带给品牌更多的话题和关注度】\n",
      "【A.明显提高茅台与蒙牛的知名度】,【B.拓展品牌的消费群体】,【C.增加产品的多样性】,【D.带给品牌更多的话题和关注度】\n",
      "【A.明显提高茅台与蒙牛的知名度】,【D.带给品牌更多的话题和关注度】\n",
      "【A.明显提高茅台与蒙牛的知名度】,【E.风险大，冰淇淋的接受直接影响了品牌口碑容易流失原本客户】\n",
      "【E.风险大，冰淇淋的接受直接影响了品牌口碑容易流失原本客户】\n",
      "【A.明显提高茅台与蒙牛的知名度】,【B.拓展品牌的消费群体】,【C.增加产品的多样性】,【D.带给品牌更多的话题和关注度】\n",
      "【A.明显提高茅台与蒙牛的知名度】,【B.拓展品牌的消费群体】,【C.增加产品的多样性】,【D.带给品牌更多的话题和关注度】\n"
     ]
    }
   ],
   "source": [
    "## 获得多选题所有选项\n",
    "df5['test'] = df5['受众自评感知联名营销效果'].str.split('┋')\n",
    "df5['test'].value_counts()\n",
    "mcq_items = []\n",
    "for g in df5['test']:\n",
    "    for label in g:\n",
    "        print(label)\n",
    "        mcq_items.append(label)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {},
   "outputs": [],
   "source": [
    "result = list(set(mcq_items))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {},
   "outputs": [],
   "source": [
    "df_mcq_1 = pd.DataFrame(data=np.zeros([len(result),2]),index=result,columns=['次数','比例'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "metadata": {},
   "outputs": [],
   "source": [
    "for i in df5['受众自评感知联名营销效果']:\n",
    "    for label in result:\n",
    "        if str(i).__contains__(label):\n",
    "            df_mcq_1.loc[label,'次数'] += 1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {},
   "outputs": [],
   "source": [
    "\"\"\"生成比例列\"\"\"\n",
    "df_mcq_1['比例'] = df_mcq_1['次数']/df5.shape[0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "metadata": {},
   "outputs": [],
   "source": [
    "df_mcq_1 = df_mcq_1.sort_values(by='比例')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>次数</th>\n",
       "      <th>比例</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>【A.明显提高茅台与蒙牛的知名度】,【C.增加产品的多样性】,【E.风险大，冰淇淋的接受直接影响了品牌口碑容易流失原本客户】</th>\n",
       "      <td>1.0</td>\n",
       "      <td>0.006536</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>【A.明显提高茅台与蒙牛的知名度】,【C.增加产品的多样性】,【D.带给品牌更多的话题和关注度】,【E.风险大，冰淇淋的接受直接影响了品牌口碑容易流失原本客户】</th>\n",
       "      <td>1.0</td>\n",
       "      <td>0.006536</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>【A.明显提高茅台与蒙牛的知名度】,【E.风险大，冰淇淋的接受直接影响了品牌口碑容易流失原本客户】</th>\n",
       "      <td>1.0</td>\n",
       "      <td>0.006536</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>【A.明显提高茅台与蒙牛的知名度】,【B.拓展品牌的消费群体】,【C.增加产品的多样性】,【E.风险大，冰淇淋的接受直接影响了品牌口碑容易流失原本客户】</th>\n",
       "      <td>1.0</td>\n",
       "      <td>0.006536</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>【A.明显提高茅台与蒙牛的知名度】,【B.拓展品牌的消费群体】,【D.带给品牌更多的话题和关注度】,【E.风险大，冰淇淋的接受直接影响了品牌口碑容易流失原本客户】</th>\n",
       "      <td>1.0</td>\n",
       "      <td>0.006536</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>【A.明显提高茅台与蒙牛的知名度】,【D.带给品牌更多的话题和关注度】,【E.风险大，冰淇淋的接受直接影响了品牌口碑容易流失原本客户】</th>\n",
       "      <td>1.0</td>\n",
       "      <td>0.006536</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>【B.拓展品牌的消费群体】,【E.风险大，冰淇淋的接受直接影响了品牌口碑容易流失原本客户】</th>\n",
       "      <td>2.0</td>\n",
       "      <td>0.013072</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>【B.拓展品牌的消费群体】,【D.带给品牌更多的话题和关注度】,【E.风险大，冰淇淋的接受直接影响了品牌口碑容易流失原本客户】</th>\n",
       "      <td>2.0</td>\n",
       "      <td>0.013072</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>【A.明显提高茅台与蒙牛的知名度】,【B.拓展品牌的消费群体】,【D.带给品牌更多的话题和关注度】</th>\n",
       "      <td>2.0</td>\n",
       "      <td>0.013072</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>【C.增加产品的多样性】,【E.风险大，冰淇淋的接受直接影响了品牌口碑容易流失原本客户】</th>\n",
       "      <td>3.0</td>\n",
       "      <td>0.019608</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>【A.明显提高茅台与蒙牛的知名度】,【D.带给品牌更多的话题和关注度】</th>\n",
       "      <td>6.0</td>\n",
       "      <td>0.039216</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>【A.明显提高茅台与蒙牛的知名度】,【C.增加产品的多样性】,【D.带给品牌更多的话题和关注度】</th>\n",
       "      <td>7.0</td>\n",
       "      <td>0.045752</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>【B.拓展品牌的消费群体】,【D.带给品牌更多的话题和关注度】</th>\n",
       "      <td>8.0</td>\n",
       "      <td>0.052288</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>【A.明显提高茅台与蒙牛的知名度】,【C.增加产品的多样性】</th>\n",
       "      <td>9.0</td>\n",
       "      <td>0.058824</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>【A.明显提高茅台与蒙牛的知名度】,【B.拓展品牌的消费群体】,【C.增加产品的多样性】,【D.带给品牌更多的话题和关注度】,【E.风险大，冰淇淋的接受直接影响了品牌口碑容易流失原本客户】</th>\n",
       "      <td>16.0</td>\n",
       "      <td>0.104575</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>【B.拓展品牌的消费群体】,【C.增加产品的多样性】,【D.带给品牌更多的话题和关注度】,【E.风险大，冰淇淋的接受直接影响了品牌口碑容易流失原本客户】</th>\n",
       "      <td>17.0</td>\n",
       "      <td>0.111111</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>【C.增加产品的多样性】,【D.带给品牌更多的话题和关注度】,【E.风险大，冰淇淋的接受直接影响了品牌口碑容易流失原本客户】</th>\n",
       "      <td>20.0</td>\n",
       "      <td>0.130719</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>【D.带给品牌更多的话题和关注度】,【E.风险大，冰淇淋的接受直接影响了品牌口碑容易流失原本客户】</th>\n",
       "      <td>25.0</td>\n",
       "      <td>0.163399</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>【E.风险大，冰淇淋的接受直接影响了品牌口碑容易流失原本客户】</th>\n",
       "      <td>36.0</td>\n",
       "      <td>0.235294</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>【A.明显提高茅台与蒙牛的知名度】,【B.拓展品牌的消费群体】,【C.增加产品的多样性】,【D.带给品牌更多的话题和关注度】</th>\n",
       "      <td>44.0</td>\n",
       "      <td>0.287582</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>【A.明显提高茅台与蒙牛的知名度】,【B.拓展品牌的消费群体】,【C.增加产品的多样性】</th>\n",
       "      <td>48.0</td>\n",
       "      <td>0.313725</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>【B.拓展品牌的消费群体】,【C.增加产品的多样性】,【D.带给品牌更多的话题和关注度】</th>\n",
       "      <td>56.0</td>\n",
       "      <td>0.366013</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>【A.明显提高茅台与蒙牛的知名度】,【B.拓展品牌的消费群体】</th>\n",
       "      <td>56.0</td>\n",
       "      <td>0.366013</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>【B.拓展品牌的消费群体】,【C.增加产品的多样性】</th>\n",
       "      <td>63.0</td>\n",
       "      <td>0.411765</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>【C.增加产品的多样性】,【D.带给品牌更多的话题和关注度】</th>\n",
       "      <td>79.0</td>\n",
       "      <td>0.516340</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>【B.拓展品牌的消费群体】</th>\n",
       "      <td>81.0</td>\n",
       "      <td>0.529412</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>【A.明显提高茅台与蒙牛的知名度】</th>\n",
       "      <td>89.0</td>\n",
       "      <td>0.581699</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>【C.增加产品的多样性】</th>\n",
       "      <td>99.0</td>\n",
       "      <td>0.647059</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>【D.带给品牌更多的话题和关注度】</th>\n",
       "      <td>100.0</td>\n",
       "      <td>0.653595</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                                                       次数        比例\n",
       "【A.明显提高茅台与蒙牛的知名度】,【C.增加产品的多样性】,【E.风险大，冰淇淋的接受直接影...    1.0  0.006536\n",
       "【A.明显提高茅台与蒙牛的知名度】,【C.增加产品的多样性】,【D.带给品牌更多的话题和关注度...    1.0  0.006536\n",
       "【A.明显提高茅台与蒙牛的知名度】,【E.风险大，冰淇淋的接受直接影响了品牌口碑容易流失原本客户】     1.0  0.006536\n",
       "【A.明显提高茅台与蒙牛的知名度】,【B.拓展品牌的消费群体】,【C.增加产品的多样性】,【E...    1.0  0.006536\n",
       "【A.明显提高茅台与蒙牛的知名度】,【B.拓展品牌的消费群体】,【D.带给品牌更多的话题和关注...    1.0  0.006536\n",
       "【A.明显提高茅台与蒙牛的知名度】,【D.带给品牌更多的话题和关注度】,【E.风险大，冰淇淋的...    1.0  0.006536\n",
       "【B.拓展品牌的消费群体】,【E.风险大，冰淇淋的接受直接影响了品牌口碑容易流失原本客户】         2.0  0.013072\n",
       "【B.拓展品牌的消费群体】,【D.带给品牌更多的话题和关注度】,【E.风险大，冰淇淋的接受直接...    2.0  0.013072\n",
       "【A.明显提高茅台与蒙牛的知名度】,【B.拓展品牌的消费群体】,【D.带给品牌更多的话题和关注度】     2.0  0.013072\n",
       "【C.增加产品的多样性】,【E.风险大，冰淇淋的接受直接影响了品牌口碑容易流失原本客户】          3.0  0.019608\n",
       "【A.明显提高茅台与蒙牛的知名度】,【D.带给品牌更多的话题和关注度】                   6.0  0.039216\n",
       "【A.明显提高茅台与蒙牛的知名度】,【C.增加产品的多样性】,【D.带给品牌更多的话题和关注度】      7.0  0.045752\n",
       "【B.拓展品牌的消费群体】,【D.带给品牌更多的话题和关注度】                       8.0  0.052288\n",
       "【A.明显提高茅台与蒙牛的知名度】,【C.增加产品的多样性】                        9.0  0.058824\n",
       "【A.明显提高茅台与蒙牛的知名度】,【B.拓展品牌的消费群体】,【C.增加产品的多样性】,【D...   16.0  0.104575\n",
       "【B.拓展品牌的消费群体】,【C.增加产品的多样性】,【D.带给品牌更多的话题和关注度】,【E...   17.0  0.111111\n",
       "【C.增加产品的多样性】,【D.带给品牌更多的话题和关注度】,【E.风险大，冰淇淋的接受直接影...   20.0  0.130719\n",
       "【D.带给品牌更多的话题和关注度】,【E.风险大，冰淇淋的接受直接影响了品牌口碑容易流失原本客户】    25.0  0.163399\n",
       "【E.风险大，冰淇淋的接受直接影响了品牌口碑容易流失原本客户】                      36.0  0.235294\n",
       "【A.明显提高茅台与蒙牛的知名度】,【B.拓展品牌的消费群体】,【C.增加产品的多样性】,【D...   44.0  0.287582\n",
       "【A.明显提高茅台与蒙牛的知名度】,【B.拓展品牌的消费群体】,【C.增加产品的多样性】         48.0  0.313725\n",
       "【B.拓展品牌的消费群体】,【C.增加产品的多样性】,【D.带给品牌更多的话题和关注度】         56.0  0.366013\n",
       "【A.明显提高茅台与蒙牛的知名度】,【B.拓展品牌的消费群体】                      56.0  0.366013\n",
       "【B.拓展品牌的消费群体】,【C.增加产品的多样性】                           63.0  0.411765\n",
       "【C.增加产品的多样性】,【D.带给品牌更多的话题和关注度】                       79.0  0.516340\n",
       "【B.拓展品牌的消费群体】                                        81.0  0.529412\n",
       "【A.明显提高茅台与蒙牛的知名度】                                    89.0  0.581699\n",
       "【C.增加产品的多样性】                                         99.0  0.647059\n",
       "【D.带给品牌更多的话题和关注度】                                   100.0  0.653595"
      ]
     },
     "execution_count": 37,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_mcq_1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/vnd.plotly.v1+json": {
       "config": {
        "plotlyServerURL": "https://plot.ly"
       },
       "data": [
        {
         "alignmentgroup": "True",
         "hovertemplate": "比例=%{x}<br>index=%{y}<extra></extra>",
         "legendgroup": "",
         "marker": {
          "color": "#636efa",
          "pattern": {
           "shape": ""
          }
         },
         "name": "",
         "offsetgroup": "",
         "orientation": "h",
         "showlegend": false,
         "textposition": "auto",
         "type": "bar",
         "x": [
          0.006535947712418301,
          0.006535947712418301,
          0.006535947712418301,
          0.006535947712418301,
          0.006535947712418301,
          0.006535947712418301,
          0.013071895424836602,
          0.013071895424836602,
          0.013071895424836602,
          0.0196078431372549,
          0.0392156862745098,
          0.0457516339869281,
          0.05228758169934641,
          0.058823529411764705,
          0.10457516339869281,
          0.1111111111111111,
          0.13071895424836602,
          0.16339869281045752,
          0.23529411764705882,
          0.2875816993464052,
          0.3137254901960784,
          0.3660130718954248,
          0.3660130718954248,
          0.4117647058823529,
          0.5163398692810458,
          0.5294117647058824,
          0.5816993464052288,
          0.6470588235294118,
          0.6535947712418301
         ],
         "xaxis": "x",
         "y": [
          "【A.明显提高茅台与蒙牛的知名度】,【C.增加产品的多样性】,【E.风险大，冰淇淋的接受直接影响了品牌口碑容易流失原本客户】",
          "【A.明显提高茅台与蒙牛的知名度】,【C.增加产品的多样性】,【D.带给品牌更多的话题和关注度】,【E.风险大，冰淇淋的接受直接影响了品牌口碑容易流失原本客户】",
          "【A.明显提高茅台与蒙牛的知名度】,【E.风险大，冰淇淋的接受直接影响了品牌口碑容易流失原本客户】",
          "【A.明显提高茅台与蒙牛的知名度】,【B.拓展品牌的消费群体】,【C.增加产品的多样性】,【E.风险大，冰淇淋的接受直接影响了品牌口碑容易流失原本客户】",
          "【A.明显提高茅台与蒙牛的知名度】,【B.拓展品牌的消费群体】,【D.带给品牌更多的话题和关注度】,【E.风险大，冰淇淋的接受直接影响了品牌口碑容易流失原本客户】",
          "【A.明显提高茅台与蒙牛的知名度】,【D.带给品牌更多的话题和关注度】,【E.风险大，冰淇淋的接受直接影响了品牌口碑容易流失原本客户】",
          "【B.拓展品牌的消费群体】,【E.风险大，冰淇淋的接受直接影响了品牌口碑容易流失原本客户】",
          "【B.拓展品牌的消费群体】,【D.带给品牌更多的话题和关注度】,【E.风险大，冰淇淋的接受直接影响了品牌口碑容易流失原本客户】",
          "【A.明显提高茅台与蒙牛的知名度】,【B.拓展品牌的消费群体】,【D.带给品牌更多的话题和关注度】",
          "【C.增加产品的多样性】,【E.风险大，冰淇淋的接受直接影响了品牌口碑容易流失原本客户】",
          "【A.明显提高茅台与蒙牛的知名度】,【D.带给品牌更多的话题和关注度】",
          "【A.明显提高茅台与蒙牛的知名度】,【C.增加产品的多样性】,【D.带给品牌更多的话题和关注度】",
          "【B.拓展品牌的消费群体】,【D.带给品牌更多的话题和关注度】",
          "【A.明显提高茅台与蒙牛的知名度】,【C.增加产品的多样性】",
          "【A.明显提高茅台与蒙牛的知名度】,【B.拓展品牌的消费群体】,【C.增加产品的多样性】,【D.带给品牌更多的话题和关注度】,【E.风险大，冰淇淋的接受直接影响了品牌口碑容易流失原本客户】",
          "【B.拓展品牌的消费群体】,【C.增加产品的多样性】,【D.带给品牌更多的话题和关注度】,【E.风险大，冰淇淋的接受直接影响了品牌口碑容易流失原本客户】",
          "【C.增加产品的多样性】,【D.带给品牌更多的话题和关注度】,【E.风险大，冰淇淋的接受直接影响了品牌口碑容易流失原本客户】",
          "【D.带给品牌更多的话题和关注度】,【E.风险大，冰淇淋的接受直接影响了品牌口碑容易流失原本客户】",
          "【E.风险大，冰淇淋的接受直接影响了品牌口碑容易流失原本客户】",
          "【A.明显提高茅台与蒙牛的知名度】,【B.拓展品牌的消费群体】,【C.增加产品的多样性】,【D.带给品牌更多的话题和关注度】",
          "【A.明显提高茅台与蒙牛的知名度】,【B.拓展品牌的消费群体】,【C.增加产品的多样性】",
          "【B.拓展品牌的消费群体】,【C.增加产品的多样性】,【D.带给品牌更多的话题和关注度】",
          "【A.明显提高茅台与蒙牛的知名度】,【B.拓展品牌的消费群体】",
          "【B.拓展品牌的消费群体】,【C.增加产品的多样性】",
          "【C.增加产品的多样性】,【D.带给品牌更多的话题和关注度】",
          "【B.拓展品牌的消费群体】",
          "【A.明显提高茅台与蒙牛的知名度】",
          "【C.增加产品的多样性】",
          "【D.带给品牌更多的话题和关注度】"
         ],
         "yaxis": "y"
        }
       ],
       "layout": {
        "barmode": "relative",
        "legend": {
         "tracegroupgap": 0
        },
        "margin": {
         "t": 60
        },
        "template": {
         "data": {
          "bar": [
           {
            "error_x": {
             "color": "#2a3f5f"
            },
            "error_y": {
             "color": "#2a3f5f"
            },
            "marker": {
             "line": {
              "color": "#E5ECF6",
              "width": 0.5
             },
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "bar"
           }
          ],
          "barpolar": [
           {
            "marker": {
             "line": {
              "color": "#E5ECF6",
              "width": 0.5
             },
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "barpolar"
           }
          ],
          "carpet": [
           {
            "aaxis": {
             "endlinecolor": "#2a3f5f",
             "gridcolor": "white",
             "linecolor": "white",
             "minorgridcolor": "white",
             "startlinecolor": "#2a3f5f"
            },
            "baxis": {
             "endlinecolor": "#2a3f5f",
             "gridcolor": "white",
             "linecolor": "white",
             "minorgridcolor": "white",
             "startlinecolor": "#2a3f5f"
            },
            "type": "carpet"
           }
          ],
          "choropleth": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "choropleth"
           }
          ],
          "contour": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "contour"
           }
          ],
          "contourcarpet": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "contourcarpet"
           }
          ],
          "heatmap": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "heatmap"
           }
          ],
          "heatmapgl": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "heatmapgl"
           }
          ],
          "histogram": [
           {
            "marker": {
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "histogram"
           }
          ],
          "histogram2d": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "histogram2d"
           }
          ],
          "histogram2dcontour": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "histogram2dcontour"
           }
          ],
          "mesh3d": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "mesh3d"
           }
          ],
          "parcoords": [
           {
            "line": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "parcoords"
           }
          ],
          "pie": [
           {
            "automargin": true,
            "type": "pie"
           }
          ],
          "scatter": [
           {
            "fillpattern": {
             "fillmode": "overlay",
             "size": 10,
             "solidity": 0.2
            },
            "type": "scatter"
           }
          ],
          "scatter3d": [
           {
            "line": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatter3d"
           }
          ],
          "scattercarpet": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattercarpet"
           }
          ],
          "scattergeo": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattergeo"
           }
          ],
          "scattergl": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattergl"
           }
          ],
          "scattermapbox": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattermapbox"
           }
          ],
          "scatterpolar": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterpolar"
           }
          ],
          "scatterpolargl": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterpolargl"
           }
          ],
          "scatterternary": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterternary"
           }
          ],
          "surface": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "surface"
           }
          ],
          "table": [
           {
            "cells": {
             "fill": {
              "color": "#EBF0F8"
             },
             "line": {
              "color": "white"
             }
            },
            "header": {
             "fill": {
              "color": "#C8D4E3"
             },
             "line": {
              "color": "white"
             }
            },
            "type": "table"
           }
          ]
         },
         "layout": {
          "annotationdefaults": {
           "arrowcolor": "#2a3f5f",
           "arrowhead": 0,
           "arrowwidth": 1
          },
          "autotypenumbers": "strict",
          "coloraxis": {
           "colorbar": {
            "outlinewidth": 0,
            "ticks": ""
           }
          },
          "colorscale": {
           "diverging": [
            [
             0,
             "#8e0152"
            ],
            [
             0.1,
             "#c51b7d"
            ],
            [
             0.2,
             "#de77ae"
            ],
            [
             0.3,
             "#f1b6da"
            ],
            [
             0.4,
             "#fde0ef"
            ],
            [
             0.5,
             "#f7f7f7"
            ],
            [
             0.6,
             "#e6f5d0"
            ],
            [
             0.7,
             "#b8e186"
            ],
            [
             0.8,
             "#7fbc41"
            ],
            [
             0.9,
             "#4d9221"
            ],
            [
             1,
             "#276419"
            ]
           ],
           "sequential": [
            [
             0,
             "#0d0887"
            ],
            [
             0.1111111111111111,
             "#46039f"
            ],
            [
             0.2222222222222222,
             "#7201a8"
            ],
            [
             0.3333333333333333,
             "#9c179e"
            ],
            [
             0.4444444444444444,
             "#bd3786"
            ],
            [
             0.5555555555555556,
             "#d8576b"
            ],
            [
             0.6666666666666666,
             "#ed7953"
            ],
            [
             0.7777777777777778,
             "#fb9f3a"
            ],
            [
             0.8888888888888888,
             "#fdca26"
            ],
            [
             1,
             "#f0f921"
            ]
           ],
           "sequentialminus": [
            [
             0,
             "#0d0887"
            ],
            [
             0.1111111111111111,
             "#46039f"
            ],
            [
             0.2222222222222222,
             "#7201a8"
            ],
            [
             0.3333333333333333,
             "#9c179e"
            ],
            [
             0.4444444444444444,
             "#bd3786"
            ],
            [
             0.5555555555555556,
             "#d8576b"
            ],
            [
             0.6666666666666666,
             "#ed7953"
            ],
            [
             0.7777777777777778,
             "#fb9f3a"
            ],
            [
             0.8888888888888888,
             "#fdca26"
            ],
            [
             1,
             "#f0f921"
            ]
           ]
          },
          "colorway": [
           "#636efa",
           "#EF553B",
           "#00cc96",
           "#ab63fa",
           "#FFA15A",
           "#19d3f3",
           "#FF6692",
           "#B6E880",
           "#FF97FF",
           "#FECB52"
          ],
          "font": {
           "color": "#2a3f5f"
          },
          "geo": {
           "bgcolor": "white",
           "lakecolor": "white",
           "landcolor": "#E5ECF6",
           "showlakes": true,
           "showland": true,
           "subunitcolor": "white"
          },
          "hoverlabel": {
           "align": "left"
          },
          "hovermode": "closest",
          "mapbox": {
           "style": "light"
          },
          "paper_bgcolor": "white",
          "plot_bgcolor": "#E5ECF6",
          "polar": {
           "angularaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "bgcolor": "#E5ECF6",
           "radialaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           }
          },
          "scene": {
           "xaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           },
           "yaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           },
           "zaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           }
          },
          "shapedefaults": {
           "line": {
            "color": "#2a3f5f"
           }
          },
          "ternary": {
           "aaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "baxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "bgcolor": "#E5ECF6",
           "caxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           }
          },
          "title": {
           "x": 0.05
          },
          "xaxis": {
           "automargin": true,
           "gridcolor": "white",
           "linecolor": "white",
           "ticks": "",
           "title": {
            "standoff": 15
           },
           "zerolinecolor": "white",
           "zerolinewidth": 2
          },
          "yaxis": {
           "automargin": true,
           "gridcolor": "white",
           "linecolor": "white",
           "ticks": "",
           "title": {
            "standoff": 15
           },
           "zerolinecolor": "white",
           "zerolinewidth": 2
          }
         }
        },
        "xaxis": {
         "anchor": "y",
         "domain": [
          0,
          1
         ],
         "title": {
          "text": "比例"
         }
        },
        "yaxis": {
         "anchor": "x",
         "domain": [
          0,
          1
         ],
         "title": {
          "text": "index"
         }
        }
       }
      }
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "fig = px.bar(df_mcq_1, x=\"比例\",orientation='h')\n",
    "fig.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>次数</th>\n",
       "      <th>比例</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>【A.品牌产品之间跨度大，比较新奇】,【D.两个品牌的忠实粉丝数量庞大】,【E.盲目跟风的人较多、跟随大家的购买风潮】</th>\n",
       "      <td>2</td>\n",
       "      <td>1.307190</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>【A.品牌产品之间跨度大，比较新奇】,【E.盲目跟风的人较多、跟随大家的购买风潮】</th>\n",
       "      <td>3</td>\n",
       "      <td>1.960784</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>【A.品牌产品之间跨度大，比较新奇】,【B.人们想体验酒味冰淇淋是否会醉酒】,【D.两个品牌的忠实粉丝数量庞大】,【E.盲目跟风的人较多、跟随大家的购买风潮】</th>\n",
       "      <td>3</td>\n",
       "      <td>1.960784</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>【A.品牌产品之间跨度大，比较新奇】,【B.人们想体验酒味冰淇淋是否会醉酒】,【C.对酒中奢侈品的追求欲望】,【E.盲目跟风的人较多、跟随大家的购买风潮】</th>\n",
       "      <td>3</td>\n",
       "      <td>1.960784</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>【B.人们想体验酒味冰淇淋是否会醉酒】,【D.两个品牌的忠实粉丝数量庞大】,【E.盲目跟风的人较多、跟随大家的购买风潮】</th>\n",
       "      <td>4</td>\n",
       "      <td>2.614379</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>【A.品牌产品之间跨度大，比较新奇】,【C.对酒中奢侈品的追求欲望】,【E.盲目跟风的人较多、跟随大家的购买风潮】</th>\n",
       "      <td>4</td>\n",
       "      <td>2.614379</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>【A.品牌产品之间跨度大，比较新奇】,【B.人们想体验酒味冰淇淋是否会醉酒】,【D.两个品牌的忠实粉丝数量庞大】</th>\n",
       "      <td>5</td>\n",
       "      <td>3.267974</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>【B.人们想体验酒味冰淇淋是否会醉酒】,【D.两个品牌的忠实粉丝数量庞大】</th>\n",
       "      <td>8</td>\n",
       "      <td>5.228758</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>【A.品牌产品之间跨度大，比较新奇】,【B.人们想体验酒味冰淇淋是否会醉酒】,【E.盲目跟风的人较多、跟随大家的购买风潮】</th>\n",
       "      <td>9</td>\n",
       "      <td>5.882353</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>【A.品牌产品之间跨度大，比较新奇】,【C.对酒中奢侈品的追求欲望】</th>\n",
       "      <td>9</td>\n",
       "      <td>5.882353</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>【A.品牌产品之间跨度大，比较新奇】,【D.两个品牌的忠实粉丝数量庞大】</th>\n",
       "      <td>10</td>\n",
       "      <td>6.535948</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>【B.人们想体验酒味冰淇淋是否会醉酒】,【E.盲目跟风的人较多、跟随大家的购买风潮】</th>\n",
       "      <td>12</td>\n",
       "      <td>7.843137</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>【A.品牌产品之间跨度大，比较新奇】,【B.人们想体验酒味冰淇淋是否会醉酒】,【C.对酒中奢侈品的追求欲望】,【D.两个品牌的忠实粉丝数量庞大】,【E.盲目跟风的人较多、跟随大家的购买风潮】</th>\n",
       "      <td>18</td>\n",
       "      <td>11.764706</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>【B.人们想体验酒味冰淇淋是否会醉酒】,【C.对酒中奢侈品的追求欲望】,【D.两个品牌的忠实粉丝数量庞大】,【E.盲目跟风的人较多、跟随大家的购买风潮】</th>\n",
       "      <td>19</td>\n",
       "      <td>12.418301</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>【D.两个品牌的忠实粉丝数量庞大】,【E.盲目跟风的人较多、跟随大家的购买风潮】</th>\n",
       "      <td>27</td>\n",
       "      <td>17.647059</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>【A.品牌产品之间跨度大，比较新奇】,【B.人们想体验酒味冰淇淋是否会醉酒】,【C.对酒中奢侈品的追求欲望】,【D.两个品牌的忠实粉丝数量庞大】</th>\n",
       "      <td>29</td>\n",
       "      <td>18.954248</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>【A.品牌产品之间跨度大，比较新奇】,【B.人们想体验酒味冰淇淋是否会醉酒】,【C.对酒中奢侈品的追求欲望】</th>\n",
       "      <td>40</td>\n",
       "      <td>26.143791</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>【B.人们想体验酒味冰淇淋是否会醉酒】,【C.对酒中奢侈品的追求欲望】</th>\n",
       "      <td>43</td>\n",
       "      <td>28.104575</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>【D.两个品牌的忠实粉丝数量庞大】</th>\n",
       "      <td>53</td>\n",
       "      <td>34.640523</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>【C.对酒中奢侈品的追求欲望】</th>\n",
       "      <td>54</td>\n",
       "      <td>35.294118</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>【E.盲目跟风的人较多、跟随大家的购买风潮】</th>\n",
       "      <td>56</td>\n",
       "      <td>36.601307</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>【A.品牌产品之间跨度大，比较新奇】,【B.人们想体验酒味冰淇淋是否会醉酒】</th>\n",
       "      <td>76</td>\n",
       "      <td>49.673203</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>【B.人们想体验酒味冰淇淋是否会醉酒】</th>\n",
       "      <td>93</td>\n",
       "      <td>60.784314</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>【A.品牌产品之间跨度大，比较新奇】</th>\n",
       "      <td>122</td>\n",
       "      <td>79.738562</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                                                     次数         比例\n",
       "【A.品牌产品之间跨度大，比较新奇】,【D.两个品牌的忠实粉丝数量庞大】,【E.盲目跟风的人较...    2   1.307190\n",
       "【A.品牌产品之间跨度大，比较新奇】,【E.盲目跟风的人较多、跟随大家的购买风潮】             3   1.960784\n",
       "【A.品牌产品之间跨度大，比较新奇】,【B.人们想体验酒味冰淇淋是否会醉酒】,【D.两个品牌的...    3   1.960784\n",
       "【A.品牌产品之间跨度大，比较新奇】,【B.人们想体验酒味冰淇淋是否会醉酒】,【C.对酒中奢侈...    3   1.960784\n",
       "【B.人们想体验酒味冰淇淋是否会醉酒】,【D.两个品牌的忠实粉丝数量庞大】,【E.盲目跟风的人...    4   2.614379\n",
       "【A.品牌产品之间跨度大，比较新奇】,【C.对酒中奢侈品的追求欲望】,【E.盲目跟风的人较多、...    4   2.614379\n",
       "【A.品牌产品之间跨度大，比较新奇】,【B.人们想体验酒味冰淇淋是否会醉酒】,【D.两个品牌的...    5   3.267974\n",
       "【B.人们想体验酒味冰淇淋是否会醉酒】,【D.两个品牌的忠实粉丝数量庞大】                 8   5.228758\n",
       "【A.品牌产品之间跨度大，比较新奇】,【B.人们想体验酒味冰淇淋是否会醉酒】,【E.盲目跟风的...    9   5.882353\n",
       "【A.品牌产品之间跨度大，比较新奇】,【C.对酒中奢侈品的追求欲望】                    9   5.882353\n",
       "【A.品牌产品之间跨度大，比较新奇】,【D.两个品牌的忠实粉丝数量庞大】                 10   6.535948\n",
       "【B.人们想体验酒味冰淇淋是否会醉酒】,【E.盲目跟风的人较多、跟随大家的购买风潮】           12   7.843137\n",
       "【A.品牌产品之间跨度大，比较新奇】,【B.人们想体验酒味冰淇淋是否会醉酒】,【C.对酒中奢侈...   18  11.764706\n",
       "【B.人们想体验酒味冰淇淋是否会醉酒】,【C.对酒中奢侈品的追求欲望】,【D.两个品牌的忠实粉...   19  12.418301\n",
       "【D.两个品牌的忠实粉丝数量庞大】,【E.盲目跟风的人较多、跟随大家的购买风潮】             27  17.647059\n",
       "【A.品牌产品之间跨度大，比较新奇】,【B.人们想体验酒味冰淇淋是否会醉酒】,【C.对酒中奢侈...   29  18.954248\n",
       "【A.品牌产品之间跨度大，比较新奇】,【B.人们想体验酒味冰淇淋是否会醉酒】,【C.对酒中奢侈...   40  26.143791\n",
       "【B.人们想体验酒味冰淇淋是否会醉酒】,【C.对酒中奢侈品的追求欲望】                  43  28.104575\n",
       "【D.两个品牌的忠实粉丝数量庞大】                                    53  34.640523\n",
       "【C.对酒中奢侈品的追求欲望】                                      54  35.294118\n",
       "【E.盲目跟风的人较多、跟随大家的购买风潮】                               56  36.601307\n",
       "【A.品牌产品之间跨度大，比较新奇】,【B.人们想体验酒味冰淇淋是否会醉酒】               76  49.673203\n",
       "【B.人们想体验酒味冰淇淋是否会醉酒】                                  93  60.784314\n",
       "【A.品牌产品之间跨度大，比较新奇】                                  122  79.738562"
      ]
     },
     "execution_count": 39,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ad_feature = mytools.gen_mcq_df(df,'受众评价联名火热原因')\n",
    "ad_feature = ad_feature.sort_values(by='比例')\n",
    "ad_feature"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/vnd.plotly.v1+json": {
       "config": {
        "plotlyServerURL": "https://plot.ly"
       },
       "data": [
        {
         "alignmentgroup": "True",
         "hovertemplate": "比例=%{x}<br>index=%{y}<extra></extra>",
         "legendgroup": "",
         "marker": {
          "color": "#636efa",
          "pattern": {
           "shape": ""
          }
         },
         "name": "",
         "offsetgroup": "",
         "orientation": "h",
         "showlegend": false,
         "textposition": "auto",
         "type": "bar",
         "x": [
          1.3071895424836601,
          1.9607843137254901,
          1.9607843137254901,
          1.9607843137254901,
          2.6143790849673203,
          2.6143790849673203,
          3.2679738562091507,
          5.228758169934641,
          5.88235294117647,
          5.88235294117647,
          6.535947712418301,
          7.8431372549019605,
          11.76470588235294,
          12.418300653594772,
          17.647058823529413,
          18.954248366013072,
          26.143790849673206,
          28.104575163398692,
          34.64052287581699,
          35.294117647058826,
          36.60130718954248,
          49.673202614379086,
          60.78431372549019,
          79.73856209150327
         ],
         "xaxis": "x",
         "y": [
          "【A.品牌产品之间跨度大，比较新奇】,【D.两个品牌的忠实粉丝数量庞大】,【E.盲目跟风的人较多、跟随大家的购买风潮】",
          "【A.品牌产品之间跨度大，比较新奇】,【E.盲目跟风的人较多、跟随大家的购买风潮】",
          "【A.品牌产品之间跨度大，比较新奇】,【B.人们想体验酒味冰淇淋是否会醉酒】,【D.两个品牌的忠实粉丝数量庞大】,【E.盲目跟风的人较多、跟随大家的购买风潮】",
          "【A.品牌产品之间跨度大，比较新奇】,【B.人们想体验酒味冰淇淋是否会醉酒】,【C.对酒中奢侈品的追求欲望】,【E.盲目跟风的人较多、跟随大家的购买风潮】",
          "【B.人们想体验酒味冰淇淋是否会醉酒】,【D.两个品牌的忠实粉丝数量庞大】,【E.盲目跟风的人较多、跟随大家的购买风潮】",
          "【A.品牌产品之间跨度大，比较新奇】,【C.对酒中奢侈品的追求欲望】,【E.盲目跟风的人较多、跟随大家的购买风潮】",
          "【A.品牌产品之间跨度大，比较新奇】,【B.人们想体验酒味冰淇淋是否会醉酒】,【D.两个品牌的忠实粉丝数量庞大】",
          "【B.人们想体验酒味冰淇淋是否会醉酒】,【D.两个品牌的忠实粉丝数量庞大】",
          "【A.品牌产品之间跨度大，比较新奇】,【B.人们想体验酒味冰淇淋是否会醉酒】,【E.盲目跟风的人较多、跟随大家的购买风潮】",
          "【A.品牌产品之间跨度大，比较新奇】,【C.对酒中奢侈品的追求欲望】",
          "【A.品牌产品之间跨度大，比较新奇】,【D.两个品牌的忠实粉丝数量庞大】",
          "【B.人们想体验酒味冰淇淋是否会醉酒】,【E.盲目跟风的人较多、跟随大家的购买风潮】",
          "【A.品牌产品之间跨度大，比较新奇】,【B.人们想体验酒味冰淇淋是否会醉酒】,【C.对酒中奢侈品的追求欲望】,【D.两个品牌的忠实粉丝数量庞大】,【E.盲目跟风的人较多、跟随大家的购买风潮】",
          "【B.人们想体验酒味冰淇淋是否会醉酒】,【C.对酒中奢侈品的追求欲望】,【D.两个品牌的忠实粉丝数量庞大】,【E.盲目跟风的人较多、跟随大家的购买风潮】",
          "【D.两个品牌的忠实粉丝数量庞大】,【E.盲目跟风的人较多、跟随大家的购买风潮】",
          "【A.品牌产品之间跨度大，比较新奇】,【B.人们想体验酒味冰淇淋是否会醉酒】,【C.对酒中奢侈品的追求欲望】,【D.两个品牌的忠实粉丝数量庞大】",
          "【A.品牌产品之间跨度大，比较新奇】,【B.人们想体验酒味冰淇淋是否会醉酒】,【C.对酒中奢侈品的追求欲望】",
          "【B.人们想体验酒味冰淇淋是否会醉酒】,【C.对酒中奢侈品的追求欲望】",
          "【D.两个品牌的忠实粉丝数量庞大】",
          "【C.对酒中奢侈品的追求欲望】",
          "【E.盲目跟风的人较多、跟随大家的购买风潮】",
          "【A.品牌产品之间跨度大，比较新奇】,【B.人们想体验酒味冰淇淋是否会醉酒】",
          "【B.人们想体验酒味冰淇淋是否会醉酒】",
          "【A.品牌产品之间跨度大，比较新奇】"
         ],
         "yaxis": "y"
        }
       ],
       "layout": {
        "barmode": "relative",
        "legend": {
         "tracegroupgap": 0
        },
        "margin": {
         "t": 60
        },
        "template": {
         "data": {
          "bar": [
           {
            "error_x": {
             "color": "#2a3f5f"
            },
            "error_y": {
             "color": "#2a3f5f"
            },
            "marker": {
             "line": {
              "color": "#E5ECF6",
              "width": 0.5
             },
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "bar"
           }
          ],
          "barpolar": [
           {
            "marker": {
             "line": {
              "color": "#E5ECF6",
              "width": 0.5
             },
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "barpolar"
           }
          ],
          "carpet": [
           {
            "aaxis": {
             "endlinecolor": "#2a3f5f",
             "gridcolor": "white",
             "linecolor": "white",
             "minorgridcolor": "white",
             "startlinecolor": "#2a3f5f"
            },
            "baxis": {
             "endlinecolor": "#2a3f5f",
             "gridcolor": "white",
             "linecolor": "white",
             "minorgridcolor": "white",
             "startlinecolor": "#2a3f5f"
            },
            "type": "carpet"
           }
          ],
          "choropleth": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "choropleth"
           }
          ],
          "contour": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "contour"
           }
          ],
          "contourcarpet": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "contourcarpet"
           }
          ],
          "heatmap": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "heatmap"
           }
          ],
          "heatmapgl": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "heatmapgl"
           }
          ],
          "histogram": [
           {
            "marker": {
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "histogram"
           }
          ],
          "histogram2d": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "histogram2d"
           }
          ],
          "histogram2dcontour": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "histogram2dcontour"
           }
          ],
          "mesh3d": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "mesh3d"
           }
          ],
          "parcoords": [
           {
            "line": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "parcoords"
           }
          ],
          "pie": [
           {
            "automargin": true,
            "type": "pie"
           }
          ],
          "scatter": [
           {
            "fillpattern": {
             "fillmode": "overlay",
             "size": 10,
             "solidity": 0.2
            },
            "type": "scatter"
           }
          ],
          "scatter3d": [
           {
            "line": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatter3d"
           }
          ],
          "scattercarpet": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattercarpet"
           }
          ],
          "scattergeo": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattergeo"
           }
          ],
          "scattergl": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattergl"
           }
          ],
          "scattermapbox": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattermapbox"
           }
          ],
          "scatterpolar": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterpolar"
           }
          ],
          "scatterpolargl": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterpolargl"
           }
          ],
          "scatterternary": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterternary"
           }
          ],
          "surface": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "surface"
           }
          ],
          "table": [
           {
            "cells": {
             "fill": {
              "color": "#EBF0F8"
             },
             "line": {
              "color": "white"
             }
            },
            "header": {
             "fill": {
              "color": "#C8D4E3"
             },
             "line": {
              "color": "white"
             }
            },
            "type": "table"
           }
          ]
         },
         "layout": {
          "annotationdefaults": {
           "arrowcolor": "#2a3f5f",
           "arrowhead": 0,
           "arrowwidth": 1
          },
          "autotypenumbers": "strict",
          "coloraxis": {
           "colorbar": {
            "outlinewidth": 0,
            "ticks": ""
           }
          },
          "colorscale": {
           "diverging": [
            [
             0,
             "#8e0152"
            ],
            [
             0.1,
             "#c51b7d"
            ],
            [
             0.2,
             "#de77ae"
            ],
            [
             0.3,
             "#f1b6da"
            ],
            [
             0.4,
             "#fde0ef"
            ],
            [
             0.5,
             "#f7f7f7"
            ],
            [
             0.6,
             "#e6f5d0"
            ],
            [
             0.7,
             "#b8e186"
            ],
            [
             0.8,
             "#7fbc41"
            ],
            [
             0.9,
             "#4d9221"
            ],
            [
             1,
             "#276419"
            ]
           ],
           "sequential": [
            [
             0,
             "#0d0887"
            ],
            [
             0.1111111111111111,
             "#46039f"
            ],
            [
             0.2222222222222222,
             "#7201a8"
            ],
            [
             0.3333333333333333,
             "#9c179e"
            ],
            [
             0.4444444444444444,
             "#bd3786"
            ],
            [
             0.5555555555555556,
             "#d8576b"
            ],
            [
             0.6666666666666666,
             "#ed7953"
            ],
            [
             0.7777777777777778,
             "#fb9f3a"
            ],
            [
             0.8888888888888888,
             "#fdca26"
            ],
            [
             1,
             "#f0f921"
            ]
           ],
           "sequentialminus": [
            [
             0,
             "#0d0887"
            ],
            [
             0.1111111111111111,
             "#46039f"
            ],
            [
             0.2222222222222222,
             "#7201a8"
            ],
            [
             0.3333333333333333,
             "#9c179e"
            ],
            [
             0.4444444444444444,
             "#bd3786"
            ],
            [
             0.5555555555555556,
             "#d8576b"
            ],
            [
             0.6666666666666666,
             "#ed7953"
            ],
            [
             0.7777777777777778,
             "#fb9f3a"
            ],
            [
             0.8888888888888888,
             "#fdca26"
            ],
            [
             1,
             "#f0f921"
            ]
           ]
          },
          "colorway": [
           "#636efa",
           "#EF553B",
           "#00cc96",
           "#ab63fa",
           "#FFA15A",
           "#19d3f3",
           "#FF6692",
           "#B6E880",
           "#FF97FF",
           "#FECB52"
          ],
          "font": {
           "color": "#2a3f5f"
          },
          "geo": {
           "bgcolor": "white",
           "lakecolor": "white",
           "landcolor": "#E5ECF6",
           "showlakes": true,
           "showland": true,
           "subunitcolor": "white"
          },
          "hoverlabel": {
           "align": "left"
          },
          "hovermode": "closest",
          "mapbox": {
           "style": "light"
          },
          "paper_bgcolor": "white",
          "plot_bgcolor": "#E5ECF6",
          "polar": {
           "angularaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "bgcolor": "#E5ECF6",
           "radialaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           }
          },
          "scene": {
           "xaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           },
           "yaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           },
           "zaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           }
          },
          "shapedefaults": {
           "line": {
            "color": "#2a3f5f"
           }
          },
          "ternary": {
           "aaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "baxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "bgcolor": "#E5ECF6",
           "caxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           }
          },
          "title": {
           "x": 0.05
          },
          "xaxis": {
           "automargin": true,
           "gridcolor": "white",
           "linecolor": "white",
           "ticks": "",
           "title": {
            "standoff": 15
           },
           "zerolinecolor": "white",
           "zerolinewidth": 2
          },
          "yaxis": {
           "automargin": true,
           "gridcolor": "white",
           "linecolor": "white",
           "ticks": "",
           "title": {
            "standoff": 15
           },
           "zerolinecolor": "white",
           "zerolinewidth": 2
          }
         }
        },
        "xaxis": {
         "anchor": "y",
         "domain": [
          0,
          1
         ],
         "title": {
          "text": "比例"
         }
        },
        "yaxis": {
         "anchor": "x",
         "domain": [
          0,
          1
         ],
         "title": {
          "text": "index"
         }
        }
       }
      }
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "fig = px.bar(ad_feature, x=\"比例\",orientation='h')\n",
    "fig.show()"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 推论统计"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>此类产品的接受程度</th>\n",
       "      <th>个数</th>\n",
       "      <th>百分比</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>【B.满意，主要看有没有自己喜欢的品牌】</td>\n",
       "      <td>65</td>\n",
       "      <td>42.48</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>【C.一般，消费不关心品牌】</td>\n",
       "      <td>54</td>\n",
       "      <td>35.29</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>【A.很满意，是强强联合的优秀成果】</td>\n",
       "      <td>30</td>\n",
       "      <td>19.61</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>【D.不满意，是一种讨厌的营销手段】</td>\n",
       "      <td>4</td>\n",
       "      <td>2.61</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>总和</td>\n",
       "      <td>153</td>\n",
       "      <td>100.00</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "              此类产品的接受程度   个数     百分比\n",
       "0  【B.满意，主要看有没有自己喜欢的品牌】   65   42.48\n",
       "1        【C.一般，消费不关心品牌】   54   35.29\n",
       "2    【A.很满意，是强强联合的优秀成果】   30   19.61\n",
       "3    【D.不满意，是一种讨厌的营销手段】    4    2.61\n",
       "4                    总和  153  100.00"
      ]
     },
     "execution_count": 41,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "mytools.gen_percent_table(df,'此类产品的接受程度')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th>性别</th>\n",
       "      <th>【A.男】</th>\n",
       "      <th>【B.女】</th>\n",
       "      <th>合计</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>此类产品的接受程度</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>【A.很满意，是强强联合的优秀成果】</th>\n",
       "      <td>14.63</td>\n",
       "      <td>21.43</td>\n",
       "      <td>19.61</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>【B.满意，主要看有没有自己喜欢的品牌】</th>\n",
       "      <td>39.02</td>\n",
       "      <td>43.75</td>\n",
       "      <td>42.48</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>【C.一般，消费不关心品牌】</th>\n",
       "      <td>41.46</td>\n",
       "      <td>33.04</td>\n",
       "      <td>35.29</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>【D.不满意，是一种讨厌的营销手段】</th>\n",
       "      <td>4.88</td>\n",
       "      <td>1.79</td>\n",
       "      <td>2.61</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "性别                    【A.男】  【B.女】     合计\n",
       "此类产品的接受程度                                \n",
       "【A.很满意，是强强联合的优秀成果】    14.63  21.43  19.61\n",
       "【B.满意，主要看有没有自己喜欢的品牌】  39.02  43.75  42.48\n",
       "【C.一般，消费不关心品牌】        41.46  33.04  35.29\n",
       "【D.不满意，是一种讨厌的营销手段】     4.88   1.79   2.61"
      ]
     },
     "execution_count": 42,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "### 双变量统计分析\n",
    "result = pd.crosstab(\n",
    "        df['此类产品的接受程度'],\n",
    "        df['性别'],\n",
    "        normalize='columns',\n",
    "        margins=True,\n",
    "        margins_name='合计',\n",
    "    )*100\n",
    "result.round(2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>此类产品的接受程度</th>\n",
       "      <th>性别</th>\n",
       "      <th>频次</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>【A.很满意，是强强联合的优秀成果】</td>\n",
       "      <td>【A.男】</td>\n",
       "      <td>6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>【A.很满意，是强强联合的优秀成果】</td>\n",
       "      <td>【B.女】</td>\n",
       "      <td>24</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>【B.满意，主要看有没有自己喜欢的品牌】</td>\n",
       "      <td>【A.男】</td>\n",
       "      <td>16</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>【B.满意，主要看有没有自己喜欢的品牌】</td>\n",
       "      <td>【B.女】</td>\n",
       "      <td>49</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>【C.一般，消费不关心品牌】</td>\n",
       "      <td>【A.男】</td>\n",
       "      <td>17</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>【C.一般，消费不关心品牌】</td>\n",
       "      <td>【B.女】</td>\n",
       "      <td>37</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>【D.不满意，是一种讨厌的营销手段】</td>\n",
       "      <td>【A.男】</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>【D.不满意，是一种讨厌的营销手段】</td>\n",
       "      <td>【B.女】</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "              此类产品的接受程度     性别  频次\n",
       "0    【A.很满意，是强强联合的优秀成果】  【A.男】   6\n",
       "1    【A.很满意，是强强联合的优秀成果】  【B.女】  24\n",
       "2  【B.满意，主要看有没有自己喜欢的品牌】  【A.男】  16\n",
       "3  【B.满意，主要看有没有自己喜欢的品牌】  【B.女】  49\n",
       "4        【C.一般，消费不关心品牌】  【A.男】  17\n",
       "5        【C.一般，消费不关心品牌】  【B.女】  37\n",
       "6    【D.不满意，是一种讨厌的营销手段】  【A.男】   2\n",
       "7    【D.不满意，是一种讨厌的营销手段】  【B.女】   2"
      ]
     },
     "execution_count": 43,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 构建绘图用数据表\n",
    "sun_df = df.groupby([\"此类产品的接受程度\",'性别']).size().reset_index(name='频次')\n",
    "sun_df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 44,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th>频次</th>\n",
       "      <th>%</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>此类产品的接受程度</th>\n",
       "      <th>性别</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">【A.很满意，是强强联合的优秀成果】</th>\n",
       "      <th>【A.男】</th>\n",
       "      <td>6</td>\n",
       "      <td>14.63</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>【B.女】</th>\n",
       "      <td>24</td>\n",
       "      <td>21.43</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">【B.满意，主要看有没有自己喜欢的品牌】</th>\n",
       "      <th>【A.男】</th>\n",
       "      <td>16</td>\n",
       "      <td>39.02</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>【B.女】</th>\n",
       "      <td>49</td>\n",
       "      <td>43.75</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">【C.一般，消费不关心品牌】</th>\n",
       "      <th>【A.男】</th>\n",
       "      <td>17</td>\n",
       "      <td>41.46</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>【B.女】</th>\n",
       "      <td>37</td>\n",
       "      <td>33.04</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">【D.不满意，是一种讨厌的营销手段】</th>\n",
       "      <th>【A.男】</th>\n",
       "      <td>2</td>\n",
       "      <td>4.88</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>【B.女】</th>\n",
       "      <td>2</td>\n",
       "      <td>1.79</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                            频次      %\n",
       "此类产品的接受程度            性别              \n",
       "【A.很满意，是强强联合的优秀成果】   【A.男】   6  14.63\n",
       "                     【B.女】  24  21.43\n",
       "【B.满意，主要看有没有自己喜欢的品牌】 【A.男】  16  39.02\n",
       "                     【B.女】  49  43.75\n",
       "【C.一般，消费不关心品牌】       【A.男】  17  41.46\n",
       "                     【B.女】  37  33.04\n",
       "【D.不满意，是一种讨厌的营销手段】   【A.男】   2   4.88\n",
       "                     【B.女】   2   1.79"
      ]
     },
     "execution_count": 44,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "temp = sun_df.set_index(['此类产品的接受程度','性别'])\n",
    "temp['%'] = 100 * (temp / temp.groupby('性别').sum())\n",
    "temp.round(2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>此类产品的接受程度</th>\n",
       "      <th>性别</th>\n",
       "      <th>频次</th>\n",
       "      <th>%</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>【A.很满意，是强强联合的优秀成果】</td>\n",
       "      <td>【A.男】</td>\n",
       "      <td>6</td>\n",
       "      <td>14.634146</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>【A.很满意，是强强联合的优秀成果】</td>\n",
       "      <td>【B.女】</td>\n",
       "      <td>24</td>\n",
       "      <td>21.428571</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>【B.满意，主要看有没有自己喜欢的品牌】</td>\n",
       "      <td>【A.男】</td>\n",
       "      <td>16</td>\n",
       "      <td>39.024390</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>【B.满意，主要看有没有自己喜欢的品牌】</td>\n",
       "      <td>【B.女】</td>\n",
       "      <td>49</td>\n",
       "      <td>43.750000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>【C.一般，消费不关心品牌】</td>\n",
       "      <td>【A.男】</td>\n",
       "      <td>17</td>\n",
       "      <td>41.463415</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>【C.一般，消费不关心品牌】</td>\n",
       "      <td>【B.女】</td>\n",
       "      <td>37</td>\n",
       "      <td>33.035714</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>【D.不满意，是一种讨厌的营销手段】</td>\n",
       "      <td>【A.男】</td>\n",
       "      <td>2</td>\n",
       "      <td>4.878049</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>【D.不满意，是一种讨厌的营销手段】</td>\n",
       "      <td>【B.女】</td>\n",
       "      <td>2</td>\n",
       "      <td>1.785714</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "              此类产品的接受程度     性别  频次          %\n",
       "0    【A.很满意，是强强联合的优秀成果】  【A.男】   6  14.634146\n",
       "1    【A.很满意，是强强联合的优秀成果】  【B.女】  24  21.428571\n",
       "2  【B.满意，主要看有没有自己喜欢的品牌】  【A.男】  16  39.024390\n",
       "3  【B.满意，主要看有没有自己喜欢的品牌】  【B.女】  49  43.750000\n",
       "4        【C.一般，消费不关心品牌】  【A.男】  17  41.463415\n",
       "5        【C.一般，消费不关心品牌】  【B.女】  37  33.035714\n",
       "6    【D.不满意，是一种讨厌的营销手段】  【A.男】   2   4.878049\n",
       "7    【D.不满意，是一种讨厌的营销手段】  【B.女】   2   1.785714"
      ]
     },
     "execution_count": 45,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sun_df = temp.reset_index()\n",
    "sun_df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/vnd.plotly.v1+json": {
       "config": {
        "plotlyServerURL": "https://plot.ly"
       },
       "data": [
        {
         "branchvalues": "total",
         "domain": {
          "x": [
           0,
           1
          ],
          "y": [
           0,
           1
          ]
         },
         "hovertemplate": "labels=%{label}<br>%=%{value}<br>parent=%{parent}<br>id=%{id}<extra></extra>",
         "ids": [
          "【A.很满意，是强强联合的优秀成果】/【A.男】",
          "【B.满意，主要看有没有自己喜欢的品牌】/【A.男】",
          "【C.一般，消费不关心品牌】/【A.男】",
          "【D.不满意，是一种讨厌的营销手段】/【A.男】",
          "【A.很满意，是强强联合的优秀成果】/【B.女】",
          "【B.满意，主要看有没有自己喜欢的品牌】/【B.女】",
          "【C.一般，消费不关心品牌】/【B.女】",
          "【D.不满意，是一种讨厌的营销手段】/【B.女】",
          "【A.很满意，是强强联合的优秀成果】",
          "【B.满意，主要看有没有自己喜欢的品牌】",
          "【C.一般，消费不关心品牌】",
          "【D.不满意，是一种讨厌的营销手段】"
         ],
         "labels": [
          "【A.男】",
          "【A.男】",
          "【A.男】",
          "【A.男】",
          "【B.女】",
          "【B.女】",
          "【B.女】",
          "【B.女】",
          "【A.很满意，是强强联合的优秀成果】",
          "【B.满意，主要看有没有自己喜欢的品牌】",
          "【C.一般，消费不关心品牌】",
          "【D.不满意，是一种讨厌的营销手段】"
         ],
         "name": "",
         "parents": [
          "【A.很满意，是强强联合的优秀成果】",
          "【B.满意，主要看有没有自己喜欢的品牌】",
          "【C.一般，消费不关心品牌】",
          "【D.不满意，是一种讨厌的营销手段】",
          "【A.很满意，是强强联合的优秀成果】",
          "【B.满意，主要看有没有自己喜欢的品牌】",
          "【C.一般，消费不关心品牌】",
          "【D.不满意，是一种讨厌的营销手段】",
          "",
          "",
          "",
          ""
         ],
         "type": "sunburst",
         "values": [
          14.634146341463413,
          39.02439024390244,
          41.46341463414634,
          4.878048780487805,
          21.428571428571427,
          43.75,
          33.035714285714285,
          1.7857142857142856,
          36.06271777003484,
          82.77439024390245,
          74.49912891986062,
          6.66376306620209
         ]
        }
       ],
       "layout": {
        "legend": {
         "tracegroupgap": 0
        },
        "margin": {
         "t": 60
        },
        "template": {
         "data": {
          "bar": [
           {
            "error_x": {
             "color": "#2a3f5f"
            },
            "error_y": {
             "color": "#2a3f5f"
            },
            "marker": {
             "line": {
              "color": "#E5ECF6",
              "width": 0.5
             },
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "bar"
           }
          ],
          "barpolar": [
           {
            "marker": {
             "line": {
              "color": "#E5ECF6",
              "width": 0.5
             },
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "barpolar"
           }
          ],
          "carpet": [
           {
            "aaxis": {
             "endlinecolor": "#2a3f5f",
             "gridcolor": "white",
             "linecolor": "white",
             "minorgridcolor": "white",
             "startlinecolor": "#2a3f5f"
            },
            "baxis": {
             "endlinecolor": "#2a3f5f",
             "gridcolor": "white",
             "linecolor": "white",
             "minorgridcolor": "white",
             "startlinecolor": "#2a3f5f"
            },
            "type": "carpet"
           }
          ],
          "choropleth": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "choropleth"
           }
          ],
          "contour": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "contour"
           }
          ],
          "contourcarpet": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "contourcarpet"
           }
          ],
          "heatmap": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "heatmap"
           }
          ],
          "heatmapgl": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "heatmapgl"
           }
          ],
          "histogram": [
           {
            "marker": {
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "histogram"
           }
          ],
          "histogram2d": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "histogram2d"
           }
          ],
          "histogram2dcontour": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "histogram2dcontour"
           }
          ],
          "mesh3d": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "mesh3d"
           }
          ],
          "parcoords": [
           {
            "line": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "parcoords"
           }
          ],
          "pie": [
           {
            "automargin": true,
            "type": "pie"
           }
          ],
          "scatter": [
           {
            "fillpattern": {
             "fillmode": "overlay",
             "size": 10,
             "solidity": 0.2
            },
            "type": "scatter"
           }
          ],
          "scatter3d": [
           {
            "line": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatter3d"
           }
          ],
          "scattercarpet": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattercarpet"
           }
          ],
          "scattergeo": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattergeo"
           }
          ],
          "scattergl": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattergl"
           }
          ],
          "scattermapbox": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattermapbox"
           }
          ],
          "scatterpolar": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterpolar"
           }
          ],
          "scatterpolargl": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterpolargl"
           }
          ],
          "scatterternary": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterternary"
           }
          ],
          "surface": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "surface"
           }
          ],
          "table": [
           {
            "cells": {
             "fill": {
              "color": "#EBF0F8"
             },
             "line": {
              "color": "white"
             }
            },
            "header": {
             "fill": {
              "color": "#C8D4E3"
             },
             "line": {
              "color": "white"
             }
            },
            "type": "table"
           }
          ]
         },
         "layout": {
          "annotationdefaults": {
           "arrowcolor": "#2a3f5f",
           "arrowhead": 0,
           "arrowwidth": 1
          },
          "autotypenumbers": "strict",
          "coloraxis": {
           "colorbar": {
            "outlinewidth": 0,
            "ticks": ""
           }
          },
          "colorscale": {
           "diverging": [
            [
             0,
             "#8e0152"
            ],
            [
             0.1,
             "#c51b7d"
            ],
            [
             0.2,
             "#de77ae"
            ],
            [
             0.3,
             "#f1b6da"
            ],
            [
             0.4,
             "#fde0ef"
            ],
            [
             0.5,
             "#f7f7f7"
            ],
            [
             0.6,
             "#e6f5d0"
            ],
            [
             0.7,
             "#b8e186"
            ],
            [
             0.8,
             "#7fbc41"
            ],
            [
             0.9,
             "#4d9221"
            ],
            [
             1,
             "#276419"
            ]
           ],
           "sequential": [
            [
             0,
             "#0d0887"
            ],
            [
             0.1111111111111111,
             "#46039f"
            ],
            [
             0.2222222222222222,
             "#7201a8"
            ],
            [
             0.3333333333333333,
             "#9c179e"
            ],
            [
             0.4444444444444444,
             "#bd3786"
            ],
            [
             0.5555555555555556,
             "#d8576b"
            ],
            [
             0.6666666666666666,
             "#ed7953"
            ],
            [
             0.7777777777777778,
             "#fb9f3a"
            ],
            [
             0.8888888888888888,
             "#fdca26"
            ],
            [
             1,
             "#f0f921"
            ]
           ],
           "sequentialminus": [
            [
             0,
             "#0d0887"
            ],
            [
             0.1111111111111111,
             "#46039f"
            ],
            [
             0.2222222222222222,
             "#7201a8"
            ],
            [
             0.3333333333333333,
             "#9c179e"
            ],
            [
             0.4444444444444444,
             "#bd3786"
            ],
            [
             0.5555555555555556,
             "#d8576b"
            ],
            [
             0.6666666666666666,
             "#ed7953"
            ],
            [
             0.7777777777777778,
             "#fb9f3a"
            ],
            [
             0.8888888888888888,
             "#fdca26"
            ],
            [
             1,
             "#f0f921"
            ]
           ]
          },
          "colorway": [
           "#636efa",
           "#EF553B",
           "#00cc96",
           "#ab63fa",
           "#FFA15A",
           "#19d3f3",
           "#FF6692",
           "#B6E880",
           "#FF97FF",
           "#FECB52"
          ],
          "font": {
           "color": "#2a3f5f"
          },
          "geo": {
           "bgcolor": "white",
           "lakecolor": "white",
           "landcolor": "#E5ECF6",
           "showlakes": true,
           "showland": true,
           "subunitcolor": "white"
          },
          "hoverlabel": {
           "align": "left"
          },
          "hovermode": "closest",
          "mapbox": {
           "style": "light"
          },
          "paper_bgcolor": "white",
          "plot_bgcolor": "#E5ECF6",
          "polar": {
           "angularaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "bgcolor": "#E5ECF6",
           "radialaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           }
          },
          "scene": {
           "xaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           },
           "yaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           },
           "zaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           }
          },
          "shapedefaults": {
           "line": {
            "color": "#2a3f5f"
           }
          },
          "ternary": {
           "aaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "baxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "bgcolor": "#E5ECF6",
           "caxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           }
          },
          "title": {
           "x": 0.05
          },
          "xaxis": {
           "automargin": true,
           "gridcolor": "white",
           "linecolor": "white",
           "ticks": "",
           "title": {
            "standoff": 15
           },
           "zerolinecolor": "white",
           "zerolinewidth": 2
          },
          "yaxis": {
           "automargin": true,
           "gridcolor": "white",
           "linecolor": "white",
           "ticks": "",
           "title": {
            "standoff": 15
           },
           "zerolinecolor": "white",
           "zerolinewidth": 2
          }
         }
        }
       }
      }
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "fig = px.sunburst(sun_df,\n",
    "                  path=['此类产品的接受程度','性别'],\n",
    "                  values='%',\n",
    "                 )\n",
    "fig.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 47,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/vnd.plotly.v1+json": {
       "config": {
        "plotlyServerURL": "https://plot.ly"
       },
       "data": [
        {
         "alignmentgroup": "True",
         "hovertemplate": "性别=%{x}<br>此类产品的接受程度=【A.很满意，是强强联合的优秀成果】<br>%=%{y}<extra></extra>",
         "legendgroup": "【A.男】",
         "marker": {
          "color": "#636efa",
          "pattern": {
           "shape": ""
          }
         },
         "name": "【A.男】",
         "offsetgroup": "【A.男】",
         "orientation": "v",
         "showlegend": true,
         "textposition": "auto",
         "type": "bar",
         "x": [
          "【A.男】"
         ],
         "xaxis": "x5",
         "y": [
          14.634146341463413
         ],
         "yaxis": "y5"
        },
        {
         "alignmentgroup": "True",
         "hovertemplate": "性别=%{x}<br>此类产品的接受程度=【B.满意，主要看有没有自己喜欢的品牌】<br>%=%{y}<extra></extra>",
         "legendgroup": "【A.男】",
         "marker": {
          "color": "#636efa",
          "pattern": {
           "shape": ""
          }
         },
         "name": "【A.男】",
         "offsetgroup": "【A.男】",
         "orientation": "v",
         "showlegend": false,
         "textposition": "auto",
         "type": "bar",
         "x": [
          "【A.男】"
         ],
         "xaxis": "x6",
         "y": [
          39.02439024390244
         ],
         "yaxis": "y6"
        },
        {
         "alignmentgroup": "True",
         "hovertemplate": "性别=%{x}<br>此类产品的接受程度=【C.一般，消费不关心品牌】<br>%=%{y}<extra></extra>",
         "legendgroup": "【A.男】",
         "marker": {
          "color": "#636efa",
          "pattern": {
           "shape": ""
          }
         },
         "name": "【A.男】",
         "offsetgroup": "【A.男】",
         "orientation": "v",
         "showlegend": false,
         "textposition": "auto",
         "type": "bar",
         "x": [
          "【A.男】"
         ],
         "xaxis": "x7",
         "y": [
          41.46341463414634
         ],
         "yaxis": "y7"
        },
        {
         "alignmentgroup": "True",
         "hovertemplate": "性别=%{x}<br>此类产品的接受程度=【D.不满意，是一种讨厌的营销手段】<br>%=%{y}<extra></extra>",
         "legendgroup": "【A.男】",
         "marker": {
          "color": "#636efa",
          "pattern": {
           "shape": ""
          }
         },
         "name": "【A.男】",
         "offsetgroup": "【A.男】",
         "orientation": "v",
         "showlegend": false,
         "textposition": "auto",
         "type": "bar",
         "x": [
          "【A.男】"
         ],
         "xaxis": "x8",
         "y": [
          4.878048780487805
         ],
         "yaxis": "y8"
        },
        {
         "alignmentgroup": "True",
         "hovertemplate": "性别=%{x}<br>此类产品的接受程度=【A.很满意，是强强联合的优秀成果】<br>%=%{y}<extra></extra>",
         "legendgroup": "【B.女】",
         "marker": {
          "color": "#EF553B",
          "pattern": {
           "shape": ""
          }
         },
         "name": "【B.女】",
         "offsetgroup": "【B.女】",
         "orientation": "v",
         "showlegend": true,
         "textposition": "auto",
         "type": "bar",
         "x": [
          "【B.女】"
         ],
         "xaxis": "x5",
         "y": [
          21.428571428571427
         ],
         "yaxis": "y5"
        },
        {
         "alignmentgroup": "True",
         "hovertemplate": "性别=%{x}<br>此类产品的接受程度=【B.满意，主要看有没有自己喜欢的品牌】<br>%=%{y}<extra></extra>",
         "legendgroup": "【B.女】",
         "marker": {
          "color": "#EF553B",
          "pattern": {
           "shape": ""
          }
         },
         "name": "【B.女】",
         "offsetgroup": "【B.女】",
         "orientation": "v",
         "showlegend": false,
         "textposition": "auto",
         "type": "bar",
         "x": [
          "【B.女】"
         ],
         "xaxis": "x6",
         "y": [
          43.75
         ],
         "yaxis": "y6"
        },
        {
         "alignmentgroup": "True",
         "hovertemplate": "性别=%{x}<br>此类产品的接受程度=【C.一般，消费不关心品牌】<br>%=%{y}<extra></extra>",
         "legendgroup": "【B.女】",
         "marker": {
          "color": "#EF553B",
          "pattern": {
           "shape": ""
          }
         },
         "name": "【B.女】",
         "offsetgroup": "【B.女】",
         "orientation": "v",
         "showlegend": false,
         "textposition": "auto",
         "type": "bar",
         "x": [
          "【B.女】"
         ],
         "xaxis": "x7",
         "y": [
          33.035714285714285
         ],
         "yaxis": "y7"
        },
        {
         "alignmentgroup": "True",
         "hovertemplate": "性别=%{x}<br>此类产品的接受程度=【D.不满意，是一种讨厌的营销手段】<br>%=%{y}<extra></extra>",
         "legendgroup": "【B.女】",
         "marker": {
          "color": "#EF553B",
          "pattern": {
           "shape": ""
          }
         },
         "name": "【B.女】",
         "offsetgroup": "【B.女】",
         "orientation": "v",
         "showlegend": false,
         "textposition": "auto",
         "type": "bar",
         "x": [
          "【B.女】"
         ],
         "xaxis": "x8",
         "y": [
          1.7857142857142856
         ],
         "yaxis": "y8"
        }
       ],
       "layout": {
        "annotations": [
         {
          "font": {},
          "showarrow": false,
          "text": "此类产品的接受程度=很满意，是强强联合的优秀成果",
          "x": 0.05375,
          "xanchor": "center",
          "xref": "paper",
          "y": 1,
          "yanchor": "bottom",
          "yref": "paper"
         },
         {
          "font": {},
          "showarrow": false,
          "text": "此类产品的接受程度=满意，主要看有没有自己喜欢的品牌",
          "x": 0.18125,
          "xanchor": "center",
          "xref": "paper",
          "y": 1,
          "yanchor": "bottom",
          "yref": "paper"
         },
         {
          "font": {},
          "showarrow": false,
          "text": "此类产品的接受程度=.一般，消费不关心品牌",
          "x": 0.30874999999999997,
          "xanchor": "center",
          "xref": "paper",
          "y": 1,
          "yanchor": "bottom",
          "yref": "paper"
         },
         {
          "font": {},
          "showarrow": false,
          "text": "此类产品的接受程度=不满意，是一种讨厌的营销手段",
          "x": 0.43625,
          "xanchor": "center",
          "xref": "paper",
          "y": 1,
          "yanchor": "bottom",
          "yref": "paper"
         },
         {
          "font": {},
          "showarrow": false,
          "text": "此类产品的接受程度=【A.很满意，是强强联合的优秀成果】",
          "x": 0.56375,
          "xanchor": "center",
          "xref": "paper",
          "y": 1,
          "yanchor": "bottom",
          "yref": "paper"
         },
         {
          "font": {},
          "showarrow": false,
          "text": "此类产品的接受程度=【B.满意，主要看有没有自己喜欢的品牌】",
          "x": 0.6912499999999999,
          "xanchor": "center",
          "xref": "paper",
          "y": 1,
          "yanchor": "bottom",
          "yref": "paper"
         },
         {
          "font": {},
          "showarrow": false,
          "text": "此类产品的接受程度=【C.一般，消费不关心品牌】",
          "x": 0.8187500000000001,
          "xanchor": "center",
          "xref": "paper",
          "y": 1,
          "yanchor": "bottom",
          "yref": "paper"
         },
         {
          "font": {},
          "showarrow": false,
          "text": "此类产品的接受程度=【D.不满意，是一种讨厌的营销手段】",
          "x": 0.94625,
          "xanchor": "center",
          "xref": "paper",
          "y": 1,
          "yanchor": "bottom",
          "yref": "paper"
         }
        ],
        "barmode": "relative",
        "legend": {
         "title": {
          "text": "性别"
         },
         "tracegroupgap": 0
        },
        "margin": {
         "t": 60
        },
        "template": {
         "data": {
          "bar": [
           {
            "error_x": {
             "color": "#2a3f5f"
            },
            "error_y": {
             "color": "#2a3f5f"
            },
            "marker": {
             "line": {
              "color": "#E5ECF6",
              "width": 0.5
             },
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "bar"
           }
          ],
          "barpolar": [
           {
            "marker": {
             "line": {
              "color": "#E5ECF6",
              "width": 0.5
             },
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "barpolar"
           }
          ],
          "carpet": [
           {
            "aaxis": {
             "endlinecolor": "#2a3f5f",
             "gridcolor": "white",
             "linecolor": "white",
             "minorgridcolor": "white",
             "startlinecolor": "#2a3f5f"
            },
            "baxis": {
             "endlinecolor": "#2a3f5f",
             "gridcolor": "white",
             "linecolor": "white",
             "minorgridcolor": "white",
             "startlinecolor": "#2a3f5f"
            },
            "type": "carpet"
           }
          ],
          "choropleth": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "choropleth"
           }
          ],
          "contour": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "contour"
           }
          ],
          "contourcarpet": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "contourcarpet"
           }
          ],
          "heatmap": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "heatmap"
           }
          ],
          "heatmapgl": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "heatmapgl"
           }
          ],
          "histogram": [
           {
            "marker": {
             "pattern": {
              "fillmode": "overlay",
              "size": 10,
              "solidity": 0.2
             }
            },
            "type": "histogram"
           }
          ],
          "histogram2d": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "histogram2d"
           }
          ],
          "histogram2dcontour": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "histogram2dcontour"
           }
          ],
          "mesh3d": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "mesh3d"
           }
          ],
          "parcoords": [
           {
            "line": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "parcoords"
           }
          ],
          "pie": [
           {
            "automargin": true,
            "type": "pie"
           }
          ],
          "scatter": [
           {
            "fillpattern": {
             "fillmode": "overlay",
             "size": 10,
             "solidity": 0.2
            },
            "type": "scatter"
           }
          ],
          "scatter3d": [
           {
            "line": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatter3d"
           }
          ],
          "scattercarpet": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattercarpet"
           }
          ],
          "scattergeo": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattergeo"
           }
          ],
          "scattergl": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattergl"
           }
          ],
          "scattermapbox": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattermapbox"
           }
          ],
          "scatterpolar": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterpolar"
           }
          ],
          "scatterpolargl": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterpolargl"
           }
          ],
          "scatterternary": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterternary"
           }
          ],
          "surface": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "surface"
           }
          ],
          "table": [
           {
            "cells": {
             "fill": {
              "color": "#EBF0F8"
             },
             "line": {
              "color": "white"
             }
            },
            "header": {
             "fill": {
              "color": "#C8D4E3"
             },
             "line": {
              "color": "white"
             }
            },
            "type": "table"
           }
          ]
         },
         "layout": {
          "annotationdefaults": {
           "arrowcolor": "#2a3f5f",
           "arrowhead": 0,
           "arrowwidth": 1
          },
          "autotypenumbers": "strict",
          "coloraxis": {
           "colorbar": {
            "outlinewidth": 0,
            "ticks": ""
           }
          },
          "colorscale": {
           "diverging": [
            [
             0,
             "#8e0152"
            ],
            [
             0.1,
             "#c51b7d"
            ],
            [
             0.2,
             "#de77ae"
            ],
            [
             0.3,
             "#f1b6da"
            ],
            [
             0.4,
             "#fde0ef"
            ],
            [
             0.5,
             "#f7f7f7"
            ],
            [
             0.6,
             "#e6f5d0"
            ],
            [
             0.7,
             "#b8e186"
            ],
            [
             0.8,
             "#7fbc41"
            ],
            [
             0.9,
             "#4d9221"
            ],
            [
             1,
             "#276419"
            ]
           ],
           "sequential": [
            [
             0,
             "#0d0887"
            ],
            [
             0.1111111111111111,
             "#46039f"
            ],
            [
             0.2222222222222222,
             "#7201a8"
            ],
            [
             0.3333333333333333,
             "#9c179e"
            ],
            [
             0.4444444444444444,
             "#bd3786"
            ],
            [
             0.5555555555555556,
             "#d8576b"
            ],
            [
             0.6666666666666666,
             "#ed7953"
            ],
            [
             0.7777777777777778,
             "#fb9f3a"
            ],
            [
             0.8888888888888888,
             "#fdca26"
            ],
            [
             1,
             "#f0f921"
            ]
           ],
           "sequentialminus": [
            [
             0,
             "#0d0887"
            ],
            [
             0.1111111111111111,
             "#46039f"
            ],
            [
             0.2222222222222222,
             "#7201a8"
            ],
            [
             0.3333333333333333,
             "#9c179e"
            ],
            [
             0.4444444444444444,
             "#bd3786"
            ],
            [
             0.5555555555555556,
             "#d8576b"
            ],
            [
             0.6666666666666666,
             "#ed7953"
            ],
            [
             0.7777777777777778,
             "#fb9f3a"
            ],
            [
             0.8888888888888888,
             "#fdca26"
            ],
            [
             1,
             "#f0f921"
            ]
           ]
          },
          "colorway": [
           "#636efa",
           "#EF553B",
           "#00cc96",
           "#ab63fa",
           "#FFA15A",
           "#19d3f3",
           "#FF6692",
           "#B6E880",
           "#FF97FF",
           "#FECB52"
          ],
          "font": {
           "color": "#2a3f5f"
          },
          "geo": {
           "bgcolor": "white",
           "lakecolor": "white",
           "landcolor": "#E5ECF6",
           "showlakes": true,
           "showland": true,
           "subunitcolor": "white"
          },
          "hoverlabel": {
           "align": "left"
          },
          "hovermode": "closest",
          "mapbox": {
           "style": "light"
          },
          "paper_bgcolor": "white",
          "plot_bgcolor": "#E5ECF6",
          "polar": {
           "angularaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "bgcolor": "#E5ECF6",
           "radialaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           }
          },
          "scene": {
           "xaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           },
           "yaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           },
           "zaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           }
          },
          "shapedefaults": {
           "line": {
            "color": "#2a3f5f"
           }
          },
          "ternary": {
           "aaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "baxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "bgcolor": "#E5ECF6",
           "caxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           }
          },
          "title": {
           "x": 0.05
          },
          "xaxis": {
           "automargin": true,
           "gridcolor": "white",
           "linecolor": "white",
           "ticks": "",
           "title": {
            "standoff": 15
           },
           "zerolinecolor": "white",
           "zerolinewidth": 2
          },
          "yaxis": {
           "automargin": true,
           "gridcolor": "white",
           "linecolor": "white",
           "ticks": "",
           "title": {
            "standoff": 15
           },
           "zerolinecolor": "white",
           "zerolinewidth": 2
          }
         }
        },
        "xaxis": {
         "anchor": "y",
         "categoryarray": [
          "【A.男】",
          "【B.女】"
         ],
         "categoryorder": "array",
         "domain": [
          0,
          0.1075
         ],
         "title": {
          "text": "性别"
         }
        },
        "xaxis2": {
         "anchor": "y2",
         "categoryarray": [
          "【A.男】",
          "【B.女】"
         ],
         "categoryorder": "array",
         "domain": [
          0.1275,
          0.235
         ],
         "matches": "x",
         "title": {
          "text": "性别"
         }
        },
        "xaxis3": {
         "anchor": "y3",
         "categoryarray": [
          "【A.男】",
          "【B.女】"
         ],
         "categoryorder": "array",
         "domain": [
          0.255,
          0.3625
         ],
         "matches": "x",
         "title": {
          "text": "性别"
         }
        },
        "xaxis4": {
         "anchor": "y4",
         "categoryarray": [
          "【A.男】",
          "【B.女】"
         ],
         "categoryorder": "array",
         "domain": [
          0.3825,
          0.49
         ],
         "matches": "x",
         "title": {
          "text": "性别"
         }
        },
        "xaxis5": {
         "anchor": "y5",
         "categoryarray": [
          "【A.男】",
          "【B.女】"
         ],
         "categoryorder": "array",
         "domain": [
          0.51,
          0.6175
         ],
         "matches": "x",
         "title": {
          "text": "性别"
         }
        },
        "xaxis6": {
         "anchor": "y6",
         "categoryarray": [
          "【A.男】",
          "【B.女】"
         ],
         "categoryorder": "array",
         "domain": [
          0.6375,
          0.745
         ],
         "matches": "x",
         "title": {
          "text": "性别"
         }
        },
        "xaxis7": {
         "anchor": "y7",
         "categoryarray": [
          "【A.男】",
          "【B.女】"
         ],
         "categoryorder": "array",
         "domain": [
          0.765,
          0.8725
         ],
         "matches": "x",
         "title": {
          "text": "性别"
         }
        },
        "xaxis8": {
         "anchor": "y8",
         "categoryarray": [
          "【A.男】",
          "【B.女】"
         ],
         "categoryorder": "array",
         "domain": [
          0.8925000000000001,
          1
         ],
         "matches": "x",
         "title": {
          "text": "性别"
         }
        },
        "yaxis": {
         "anchor": "x",
         "domain": [
          0,
          1
         ],
         "title": {
          "text": "%"
         }
        },
        "yaxis2": {
         "anchor": "x2",
         "domain": [
          0,
          1
         ],
         "matches": "y",
         "showticklabels": false
        },
        "yaxis3": {
         "anchor": "x3",
         "domain": [
          0,
          1
         ],
         "matches": "y",
         "showticklabels": false
        },
        "yaxis4": {
         "anchor": "x4",
         "domain": [
          0,
          1
         ],
         "matches": "y",
         "showticklabels": false
        },
        "yaxis5": {
         "anchor": "x5",
         "domain": [
          0,
          1
         ],
         "matches": "y",
         "showticklabels": false
        },
        "yaxis6": {
         "anchor": "x6",
         "domain": [
          0,
          1
         ],
         "matches": "y",
         "showticklabels": false
        },
        "yaxis7": {
         "anchor": "x7",
         "domain": [
          0,
          1
         ],
         "matches": "y",
         "showticklabels": false
        },
        "yaxis8": {
         "anchor": "x8",
         "domain": [
          0,
          1
         ],
         "matches": "y",
         "showticklabels": false
        }
       }
      }
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "fig = px.bar(\n",
    "    sun_df,  # 带绘图数据 \n",
    "    x=\"性别\",  # x轴\n",
    "    y=\"%\",  # y轴\n",
    "    color=\"性别\",\n",
    "    facet_col=\"此类产品的接受程度\",  # 列\n",
    "    category_orders={\"此类产品的接受程度\": [\"很满意，是强强联合的优秀成果\", \"满意，主要看有没有自己喜欢的品牌\", \".一般，消费不关心品牌\",\"不满意，是一种讨厌的营销手段\"]},\n",
    ")\n",
    "fig.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 48,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'tau_y值为：0.004，该值属于极弱相关或不相关。'"
      ]
     },
     "execution_count": 48,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "tau_y = mytools.goodmanKruska_tau_y(df, '性别', '此类产品的接受程度')\n",
    "F'tau_y值为：{tau_y:.3f}，该值属于{mytools.draw_on_corr(tau_y)}。'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 49,
   "metadata": {},
   "outputs": [],
   "source": [
    "from scipy import stats\n",
    "x=df['性别']\n",
    "y=df['此类产品的接受程度']\n",
    "chi2, p, dof, ex = stats.chi2_contingency(pd.crosstab(x, y))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 50,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(2.566146810506566, 0.46345538084024096)"
      ]
     },
     "execution_count": 50,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "chi2,p"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 51,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'p': 'p=0.463>0.05', 'tex_p': 'p>0.05', 'conclusion': '接收虚无假设，拒绝研究假设。'}"
      ]
     },
     "execution_count": 51,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "mytools.p_result(p)"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "对茅台冰淇淋产品所做的调查发现，不同性别的大学生茅台冰淇淋的消费行为和态度无显著性差异（p=0.463）。"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3.8.10 64-bit",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.10"
  },
  "orig_nbformat": 4,
  "vscode": {
   "interpreter": {
    "hash": "723d4b7bc280cd31fdada53ad6420192b9a3a8d60631096143cc718cb9440dc1"
   }
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
